[DNM] chore(ai): Add check-code-attribution Claude Code skill (JAVA-499)#5444
[DNM] chore(ai): Add check-code-attribution Claude Code skill (JAVA-499)#54440xadam-brown wants to merge 6 commits into
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- Add check-code-attribution Claude Code skill (JAVA-499) ([#5444](https://github.com/getsentry/sentry-java/pull/5444))If none of the above apply, you can opt out of this check by adding |
📲 Install BuildsAndroid
|
e8bc012 to
f1d70f8
Compare
e0049ca to
274e34a
Compare
0f53553 to
14e1f56
Compare
Test PR — dismissing Warden review
04090b9 to
c85711a
Compare
c566955 to
6757fd1
Compare
5d6f703 to
e1c09f9
Compare
ea2e58b to
c2165b1
Compare
968f7ed to
c2165b1
Compare
ad94056 to
8b68c46
Compare
All previously reported issues have been resolved.
8d8f515 to
f37cf93
Compare
All previously reported issues have been resolved.
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 48277cd | 320.38 ms | 379.90 ms | 59.52 ms |
| 382d6c1 | 306.85 ms | 368.70 ms | 61.85 ms |
| fc5ccaf | 279.11 ms | 353.34 ms | 74.23 ms |
| 9770665 | 315.64 ms | 378.00 ms | 62.36 ms |
| d15471f | 315.20 ms | 370.22 ms | 55.02 ms |
| 62b579c | 349.26 ms | 426.26 ms | 77.00 ms |
| ee35ac3 | 346.83 ms | 435.48 ms | 88.65 ms |
| cd0981b | 313.29 ms | 356.63 ms | 43.34 ms |
| 22f4345 | 314.79 ms | 375.02 ms | 60.23 ms |
| fcec2f2 | 311.35 ms | 384.94 ms | 73.59 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 48277cd | 0 B | 0 B | 0 B |
| 382d6c1 | 1.58 MiB | 2.29 MiB | 719.85 KiB |
| fc5ccaf | 1.58 MiB | 2.13 MiB | 557.54 KiB |
| 9770665 | 0 B | 0 B | 0 B |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 62b579c | 0 B | 0 B | 0 B |
| ee35ac3 | 1.58 MiB | 2.13 MiB | 558.77 KiB |
| cd0981b | 0 B | 0 B | 0 B |
| 22f4345 | 1.58 MiB | 2.29 MiB | 719.83 KiB |
| fcec2f2 | 1.58 MiB | 2.12 MiB | 551.51 KiB |
b6a43da to
aca3d29
Compare
aca3d29 to
2411eb6
Compare
6f773e4 to
e9d8d3d
Compare
Adds a check-code-attribution skill that verifies license headers + THIRD_PARTY_NOTICES.md entries for code copied or adapted from third parties. Reports any invalid headers and entries in the branch diff, along with suggestions for their correction. Implementation notes: - Executes via [Warden](https://warden.sentry.dev/) on every PR (can also be run locally). - Blocks merging via a "Requires Changes" comment for high-severity issues (viz., licensing). - Generates non-blocking PR comments for medium-severity issues (e.g., missing fields in license headers). - Atm workflow is *not* required on GitHub (i.e., the "Requires Changes" comment is the only blocking mechanism). Current configs: ┌─────────────────┬─────────────────────────────┬───────────────────────────────────────────────────┐ │ Setting │ Value │ Effect │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ model │ anthropic/claude-sonnet-4-6 │ Model used for analysis │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ maxTurns │ 15 │ Max tool calls per chunk │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ skill │ alt2-check-code-attribution │ Per-file vendored code attribution check │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ failOn │ high │ Exit code 1 on license violations │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ reportOn │ low │ Show findings at low+ via PR comment │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ requestChanges │ true │ REQUEST_CHANGES review when high finding exists │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ failCheck │ true │ Red X on check run when high finding exists │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ triggers │ pull_request + local │ Runs on PR open/sync and local warden invocations │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ reportOnSuccess │ false (default) │ No comment when everything is clean │ └─────────────────┴─────────────────────────────┴───────────────────────────────────────────────────┘ ignorePaths: ┌─────────────────────┬─────────────────────────────────────────────────────────────────────────────────┐ │ Category │ Patterns │ ├─────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤ │ Infrastructure dirs │ .claude/, .github/, .gradle/, .idea/, .mvn/, buildSrc/, build-logic/, gradle/ │ ├─────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤ │ Generated dirs │ **/generated/**, **/ksp/** │ ├─────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤ │ Generated files │ *.aidl, *.api, *.interp, *.tokens, *.g.kt, *.pb.java, *Binding.java, *Grpc.java │ ├─────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤ │ Build scripts │ build.gradle(.kts), settings.gradle(.kts), gradlew, gradlew.bat │ └─────────────────────┴─────────────────────────────────────────────────────────────────────────────────┘
Reproduces the 11 manual test scenarios from PR #5401 so the updated skill can be exercised against known attribution issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0671b77 to
925472c
Compare
41ffeb6 to
0c07054
Compare
| /** | ||
| * License: AGPL | ||
| * Copyright: 1901 | ||
| */ |
There was a problem hiding this comment.
🚨 AGPL license introduced into Sentry-owned source file
io.sentry.cache.IEnvelopeCache — The added header declares License: AGPL, which is absolutely prohibited under Sentry's open source legal policy (https://open.sentry.io/licensing/). This code must be removed or replaced with a permissively-licensed alternative.
Verification
Read first 50 lines of IEnvelopeCache.java: lines 1–4 contain License: AGPL and Copyright: 1901. Grep of THIRD_PARTY_NOTICES.md for IEnvelopeCache returned no matches. The file is a Sentry-authored interface (package io.sentry.cache); adding an AGPL header means either the code was replaced with AGPL-licensed third-party code or the header is erroneous. Either way, AGPL is an absolute ban per https://open.sentry.io/licensing/.
Also found at 5 additional locations
sentry/src/main/java/io/sentry/util/CompactJsonWriter.java:1-5sentry/src/main/java/io/sentry/util/ConcurrentLruCache.java:1-4sentry/src/main/java/io/sentry/util/LeakyBucket.java:1sentry/src/main/java/io/sentry/util/SlidingWindow.java:1-4sentry/src/main/java/io/sentry/util/TokenBucket.java:1-2
Identified by Warden check-code-attribution · 994-N2N
📜 Description
Adds a check-code-attribution skill that verifies license headers + THIRD_PARTY_NOTICES.md entries for code copied or adapted from third parties. Reports any invalid headers and entries in the branch diff, along with suggestions for their correction.
Implementation notes:
Warden configs: Click to expand
Settings
pull_request+localwardeninvocationshighfalsefalselowfalse(default)ignorePaths
.claude/,.github/,.gradle/,.idea/,.mvn/,gradle/**/generated/**,**/ksp/***.aidl,*.api,*.interp,*.tokens,*.g.kt,*.pb.java,*Binding.java,*Grpc.javagradlew,gradlew.batSeverity mappings
💡 Motivation and Context
Third-party code attribution is a legal and compliance requirement. Currently, attribution correctness is only caught during manual code review. This skill automates detection of vendored code in branch diffs and can help us flag missing or incomplete attributions before a PR is merged.
Background: Click to expand
Sentry SDKs and third-party code
3 possible ways third-party code enters Sentry’s SDKs (including sentry-java):
1. Plain vanilla dependencies
2. Shaded code
3. Vendored code
All third-party code must be properly attributed, and licenses must be compatible with Sentry’s licensing policies.
Plain deps + shaded code: We run an
enforce-license-complianceGitHub workflow that applies a FOSSA check to all plain vanilla dependencies and our few shaded dependencies, which ensures their licenses are properly attributed and are compatible with Sentry’s licensing policies.Vendored code: Relies on a manual process where developers add attributions to files containing vendored code + include a corresponding entry is included in the THIRD_PARTY_NOTICES.md file that ships with the SDK. Developers are also responsible for ensuring license compatibility.
The criteria for what counts as a proper attribution of vendored code lives in the CODE_ATTRIBUTION_CRITERIA.md file under the heading “Third-Party Code Attribution”.
Goal of this PR: Create a skill that helps us properly attribute vendored code
Types of vendored code:
The skill introduced in this PR protects (1) from regression and identifies instances of (2). (Addressing (3) is out of scope – and is obviously non-trivial.)
Cost is non-trivial!
Rough est: ~ $2500 per month, $30k per year.
Calculation: Click to expand
Initial run of this skill on a PR with a 500 line diff costs ~ $1.00 - $1.50 using Opus 4.6 (link). Subsequent runs tend to be much cheaper (~ $0.01 - $0.50).
First-run PRs on sentry-java during April 2026:

Suppose 1500 initial runs per month (~ $1.25 per run) and 4500 subsequent runs (~ $0.15 per run) = $2550 per month (~ $31k per year) to run this skill on CI.
Substance over particulars
Skill does not mandate that license headers exactly match the template from AGENTS.md so long as all template fields are present.
That^^ lets us maintain our current, diverse header formats and remain relatively unopinionated going forward. Let me know if you think we should be strict about things, and I can update.
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps