From 3b7e09211acee83c503f7d33321c0412f46cf72c Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Tue, 24 Nov 2026 09:01:01 +0100 Subject: [PATCH 1/2] docs(agents): Add comment, merge, test scope and PR target rules --- .claude/skills/create-java-pr/SKILL.md | 9 ++++++++ .claude/skills/test/SKILL.md | 11 ++++++++- AGENTS.md | 31 ++++++++++++++++++++++++-- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index 52ab0e9bb60..30c5c3e2fc3 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -112,6 +112,15 @@ default body shape — it is the single source of truth for the sections and che reproduce it from memory. Fill in each section based on the changes being PR'd, drop the HTML comment hints, and check any checklist items that apply. +Before you create the PR, check which repository `gh` targets: + +```bash +gh repo set-default --view +``` + +If it prints anything other than `getsentry/sentry-java`, or nothing, ask the user which repository +to target. Don't let `gh` pick a community fork. + Write the body to `/tmp/pr-body-.md`, with each `/` in the branch name replaced by `-`, not to pr-writer's `/tmp/pr-body.md`: that file outlives sessions and can still hold another PR's body. Only after the write succeeds, pass that file to `gh pr create` in place of pr-writer's: diff --git a/.claude/skills/test/SKILL.md b/.claude/skills/test/SKILL.md index 5e19619b1b2..02aee505192 100644 --- a/.claude/skills/test/SKILL.md +++ b/.claude/skills/test/SKILL.md @@ -60,11 +60,20 @@ With a test class filter: ./gradlew '::' --tests="**" --info ``` -Without a filter: +Without a filter, only when the user asks for the whole module (CI runs full suites): ```bash ./gradlew '::' --info ``` +When you choose the tests yourself, filter to the classes or packages the change touches, plus the +tests of direct callers. Pass `--tests` once per pattern: +```bash +./gradlew '::' --tests="io.sentry.foo.*" --tests="*BarTest*" +``` + +Don't add `--rerun` or `--no-build-cache` by default. An `UP-TO-DATE` test task already passed on the +same inputs. Use them only for a named doubt, such as a suspected flaky test. + ## Step 3b: Run an Integration Test Suite The suite's task is named after its source set directory: `src/integrationTestWebflux/...` runs diff --git a/AGENTS.md b/AGENTS.md index 042d66e98f4..5948f46ebf6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,8 +80,9 @@ resolves the per-module test task, including integration test suites, for you. 3. **Use todo tracking**: Work through todo items, marking them as complete as you go 4. **High-level communication**: Give high-level explanations of changes made, not step-by-step descriptions 5. **Simplicity first**: Make every task and code change as simple as possible. Avoid massive or complex changes. Impact as little code as possible. -6. **Format and regenerate**: Once done, format code and regenerate .api files: `make format api` -7. **Propose commit**: As final step, git stage relevant files and propose (but not execute) a single git commit command. This applies to implementation work; when the task is to open a PR, the `create-java-pr` skill takes over from here and does commit, push, and open it. +6. **Don't code for impossible states**: Before you add state tracking or heuristics around a framework object, find out its real lifecycle. +7. **Format and regenerate**: Once done, format code and regenerate .api files: `make format api` +8. **Propose commit**: As final step, git stage relevant files and propose (but not execute) a single git commit command. This applies to implementation work; when the task is to open a PR, the `create-java-pr` skill takes over from here and does commit, push, and open it. ## Repository Skills @@ -133,6 +134,21 @@ The repository is organized into multiple modules: - **Formatting**: Enforced via Spotless - **API Compatibility**: Binary compatibility is enforced. `.api` files are generated, never hand-edited +### Comments + +The default is no comment. Add one only when it gives a reason that the code, the names, and the +class Javadoc don't, in one short sentence: a rationale, a gotcha, the meaning of a magic number, +why an empty catch is safe, or a comment this file requires (for example on a broad catch). + +- Don't describe what the next line does, in production code or in tests. +- Don't repeat what a method Javadoc already describes. +- Existing narrating comments are not a pattern to copy. + +**Javadoc of an interface, callback, or model class describes only the type itself**, in general +terms. Requirements on the implementer are fine ("Must be fast, no I/O."). Don't name who calls it, +when, or on which thread: a type can't promise how others use it. A thread contract belongs on the +methods of the component that owns the thread. + ### Exception Handling The following section applies only in cases where the spec (sentry-docs) do not define an exception @@ -283,6 +299,17 @@ User-facing changes get an entry under the `## Unreleased` section of `CHANGELOG `create-java-pr` skill is the source of truth for the full changelog and PR workflow, including subsection selection and the rebase caveat when a release renames `## Unreleased`. +### After Merging `main` or Resolving Conflicts + +Do these before you commit the merge, even when `CHANGELOG.md` is not in the conflict list: + +1. Run `make format api`, then stage what it changed. +2. Make sure the branch's changelog entry is under `## Unreleased`. Look at the `## ` headings, not + only at the diff: when `main` cut a release, git auto-merges the entry into the released section + without a conflict, sometimes with a duplicate subsection heading. +3. Compile and run the tests of the modules you changed. `main` adds build checks over time, so code + that passed before the merge can fail after it. + ## Useful Resources - Main SDK documentation: https://develop.sentry.dev/sdk/overview/ From 556b838896bba9cae0ee2a8ba38d0aed9986fb2a Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Tue, 24 Nov 2026 12:49:22 +0100 Subject: [PATCH 2/2] docs(agents): Drop --info from test skill and dedupe post-merge checks --- .claude/skills/create-java-pr/SKILL.md | 2 +- .claude/skills/test/SKILL.md | 4 ++-- AGENTS.md | 13 ++++--------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index 30c5c3e2fc3..613f0c6f62f 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -178,7 +178,7 @@ Add an entry to `CHANGELOG.md` under the `## Unreleased` section. Create the subsection under `## Unreleased` if it does not already exist. -**When rebasing:** A rebase onto `main` can land your branch after a release was cut, where the `## Unreleased` heading your entry lived under has since been renamed to that version number. If that happens, move your new entry into an `## Unreleased` section at the top of `CHANGELOG.md` (create the section if it no longer exists) so it is not left under an already-released version. +**When rebasing or merging `main`:** Your branch can land after a release was cut, where the `## Unreleased` heading your entry lived under has since been renamed to that version number. A merge does this without a conflict, sometimes with a duplicate subsection heading, so check the `## ` headings, not only the diff. If that happens, move your new entry into an `## Unreleased` section at the top of `CHANGELOG.md` (create the section if it no longer exists) so it is not left under an already-released version. #### Entry format diff --git a/.claude/skills/test/SKILL.md b/.claude/skills/test/SKILL.md index 02aee505192..97622bfcbe3 100644 --- a/.claude/skills/test/SKILL.md +++ b/.claude/skills/test/SKILL.md @@ -57,12 +57,12 @@ If the user picks a specific method, use `--tests="*ClassName.methodName"` as th With a test class filter: ```bash -./gradlew '::' --tests="**" --info +./gradlew '::' --tests="**" ``` Without a filter, only when the user asks for the whole module (CI runs full suites): ```bash -./gradlew '::' --info +./gradlew '::' ``` When you choose the tests yourself, filter to the classes or packages the change touches, plus the diff --git a/AGENTS.md b/AGENTS.md index 5948f46ebf6..7b825f221f8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -297,18 +297,13 @@ gh pr view --json url -q '.url' User-facing changes get an entry under the `## Unreleased` section of `CHANGELOG.md`. The `create-java-pr` skill is the source of truth for the full changelog and PR workflow, including -subsection selection and the rebase caveat when a release renames `## Unreleased`. +subsection selection and the rebase and merge caveat when a release renames `## Unreleased`. ### After Merging `main` or Resolving Conflicts -Do these before you commit the merge, even when `CHANGELOG.md` is not in the conflict list: - -1. Run `make format api`, then stage what it changed. -2. Make sure the branch's changelog entry is under `## Unreleased`. Look at the `## ` headings, not - only at the diff: when `main` cut a release, git auto-merges the entry into the released section - without a conflict, sometimes with a duplicate subsection heading. -3. Compile and run the tests of the modules you changed. `main` adds build checks over time, so code - that passed before the merge can fail after it. +Before you commit the merge, format and regenerate (workflow rule 7) and check the changelog entry +(the `create-java-pr` rebase and merge caveat). Then compile and run the tests of the modules you +changed: `main` adds build checks over time, so code that passed before the merge can fail after it. ## Useful Resources