Repository navigation
ci(lint): Add decision-model-linter with SDK review rules - #6823
Draft
runningcode wants to merge 4 commits into
Draft
runningcode wants to merge 4 commits into
runningcode wants to merge 4 commits into
Conversation
Adds rules that a small model answers from the changed lines of one file: exception handling, PII, tests, public API annotations, Kotlin interop, Android, instrumentation, resources and time, and Gradle build logic. Rules that a parser can decide stay with detekt, Error Prone and Spotless, and rules that need reading across files stay with Warden. Every rule starts at warn, so findings are reported but never fail the check. A file the model could not check fails the check, so a green run means every changed file was reviewed. Fork PRs get no secrets and skip the lint. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
PR risk: mediumFor commit The model rated this change low. It was raised to medium because:
This label is a hint for reviewers, not an approval. |
📲 Install BuildsAndroid
|
The config ignores sentry-android-integration-tests entirely, so its UI tests never got the tests suite. The tests suite now re-includes the modules' src directories, matches androidTest flavor source sets such as androidTestReplay, and covers the macrobenchmark module, which keeps its tests in src/main. SDK suites still ignore the modules' app code. sentry-samples has no test source sets. flakyWait flagged a Thread.yield() poll bounded by a deadline, though nothing signals that a thread has parked. It now reports only fixed sleeps, unbounded waits, ordering assumptions, and polls where a Future, latch, idling resource, fake clock, or the executor's completion was available. lostExecutorException reports tasks whose exceptions would vanish in a Future nobody reads. unjustifiedBroadCatch now lists the task body as a boundary, so the catch both rules ask for agrees with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Spring and servlet modules keep tests that run against a real server in integrationTest source sets, which no suite matched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment on lines
+61
to
+77
| comment=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR/comments" --paginate \ | ||
| --jq ".[] | select(.user.login == \"github-actions[bot]\" and (.body | contains(\"$marker\"))) | .id" | head -n 1) | ||
| body= | ||
| if [ -s "$report" ] && { [ "$status" -le 1 ] || [ "$OVERRIDDEN" = true ]; }; then | ||
| body=$(printf '%s\n%s' "$marker" "$(cat "$report")") | ||
| elif [ "$status" -eq 0 ] && [ -n "$comment" ]; then | ||
| body=$(printf '%s\nNo findings on the latest commit.' "$marker") | ||
| fi | ||
| if [ -n "$body" ] && [ -n "$comment" ]; then | ||
| gh api -X PATCH "repos/$GITHUB_REPOSITORY/issues/comments/$comment" -f body="$body" > /dev/null | ||
| elif [ -n "$body" ]; then | ||
| gh api "repos/$GITHUB_REPOSITORY/issues/$PR/comments" -f body="$body" > /dev/null | ||
| fi | ||
| cat "$report" >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| if [ "$status" -ne 0 ] && [ "$OVERRIDDEN" = true ]; then exit 0; fi | ||
| exit "$status" |
There was a problem hiding this comment.
Comment API write failure bypasses the lint status gate
If a GitHub comment create or update fails, -e exits before the intended status gate: an otherwise-clean run with an existing comment fails, and an override cannot pass failed lint. The comment lookup pipeline does not have the claimed pipefail behavior because this step uses GitHub Actions’ default shell.
Evidence
- The step does not specify
shell:, so GitHub Actions uses its default Bash shell with-e, not-o pipefail. - When lint succeeds and an existing bot comment is found, lines 66–70 set a “No findings” body and make an unguarded PATCH request. For a failed lint with the override label, lines 64–72 likewise write the report before reaching the override gate.
- A nonzero result from either direct
gh apiwrite exits the script under-e, skipping lines 76–77; thus a comment-write failure can fail a clean check or prevent the override from taking effect. The lookup pipeline’s status is instead the finalheadstatus without `pipefail.
Identified by Warden · code-review · YQX-HGT
Drop publicApi.undocumentedNull, which fired 10 times on October and November PRs without one finding worth a comment. Let unjustifiedBroadCatch accept a commented catch that must also catch LinkageError, since rethrowIfFatal would rethrow it. Make hollowAssertion catch fake clocks that are never advanced. Add two executor rules for missed review comments: hold the SDK executor only as a local, and schedule timeouts on the timer executor. Co-Authored-By: Claude Opus 5.5 <[email protected]>
runningcode
force-pushed
the
no/decision-model-linter
branch
from
December 1, 2026 14:47
f925672 to
43a8ff3
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Adds decision-model-linter with 30 review rules for sentry-java. Each rule is a yes/no question that
typesafe/jev-1.13answers about the changed lines of one file:safetyInterruptedException, capturing the SDK's own failures, PII withoutsendDefaultPii, scrubbers that fail open, optional dependency probestestspublicApi@ApiStatus, missing@TestOnlykotlinInteropandroidsentry-android*@RequiresApi, redundantNewApisuppressioninstrumentationresourcesgradlebuild-logicThe rules come from
REVIEWS.mdand from six months of human review comments on this repo. Anything a parser can decide, such as banned calls and imports, formatting, or unused code, is left out on purpose. It belongs in detekt, Error Prone, or Spotless, not a model.The workflow lints each PR's changed lines and keeps one comment with the findings.
warn. Findings are reported but never fail the check, and a rule moves toerroronly after it proves precise on real PRs.uncheckediserror: if the model could not check a file, the check fails. A green check therefore means every changed file was reviewed.Override decision model lintlabel to pass a failing check while the findings stay reported.pull_request, neverpull_request_target.WARDEN_OPENROUTER_API_KEY, which this repo already receives.AI_GATEWAY_API_KEYdoesn't work here because the linter only supports OpenRouter's decisions endpoint.💡 Motivation and Context
The goal is that a PR is only ready for human review once automated review has passed. Warden's
java-sdk-reviewskill covers the rules that need reading across files. This linter covers the rest, more cheaply, and each rule's precision can be tuned or removed on its own.💚 How did you test it?
Loaded the config with the pinned linter (0.3.0) and checked which suites match sample paths: core, Android, test, Kotlin, Gradle, build-logic, samples, and generated files. Backtested on 80 PRs merged in October and November, which were not used to write the rules. Each PR was reviewed as it looked at its first review comment. There was no OpenRouter key, so agents emulated jev on the changed lines. They found 38 problems: 5 correct, 30 plausible, 3 false positives.
After the backtest:
publicApi.undocumentedNullis dropped (10 hits, none worth a comment).safety.unjustifiedBroadCatchaccepts a commented catch that must also catchLinkageError.tests.hollowAssertioncatches fake clocks that are never advanced.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
REVIEWS.mdinto detekt and Error Prone.🤖 Generated with Claude Code
#skip-changelog