Skip to content

Commit a2184a3

Browse files
authored
docs(agents): Remove duplicated build commands and rules (#5971)
* docs(agents): Remove duplicated build commands and rules AGENTS.md is force-read at the start of every session, so anything stated there costs context on every task. Several rules had accumulated multiple copies of themselves within that one file. `spotlessApply`/`apiDump` was stated five times in AGENTS.md; it is now stated once as a command and once as a workflow step, with the underlying facts (Spotless enforces formatting, `.api` files are generated) kept where they belong. The Testing command block is dropped in favour of the `test` skill, which already resolves the per-module task and the unit-vs-system split and does not drift. The Repository Skills bullet list restated skill descriptions that the harness already injects, so it is now a pointer. In the rules, `new_module.mdc`'s "Important Notes" was a verbatim restatement of the AGENTS.md contributing guidelines, and `api.mdc` repeated the opt-in-by-default rule in passing; both now defer to their canonical homes. No guidance is lost — every removed line is still stated somewhere that is loaded when it applies. * docs(agents): Refresh new_module rule and cover full system-test runs Validating the previous commit with agents surfaced two gaps. `new_module.mdc` had drifted from the repo. Its README badge snippet still used the retired maven-badges.herokuapp.com format, while every current row in README.md uses shields.io with a central.sonatype.com link. It also never mentioned four steps that every existing integration module performs: the `SENTRY_*_SDK_NAME` constant in `Config.kt` consumed by buildConfig and the jar manifest, the `libs.versions.toml` entry paired with a `compileOnly` dependency, self-registration via `SentryIntegrationPackageStorage.addPackage` and `addIntegrationToSdkVersion`, and the integrations dropdown in the issue template. It now also points at `sentry-kafka` and `sentry-android-timber` as build-script templates, and records that `sentry-bom` and the root build file need no change because they iterate over subprojects. The `test` skill only ever ran a single module, so folding the AGENTS.md testing block into it dropped the only reference to running the whole system test suite. Step 3b now covers `make systemTest` and `make systemTestInteractive`.
1 parent 79f1f2f commit a2184a3

4 files changed

Lines changed: 62 additions & 51 deletions

File tree

‎.claude/skills/test/SKILL.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ test -d .venv || make setupPython
7878

7979
This starts the mock Sentry server, starts the sample app (Spring Boot/Tomcat/CLI), runs tests via `./gradlew :sentry-samples:<sample-module>:systemTest`, and cleans up afterwards.
8080

81+
To run **every** system test instead of one module, use the Makefile targets — they also create the
82+
venv for you:
83+
84+
```bash
85+
make systemTest # all system tests (--all)
86+
make systemTestInteractive # pick the setups to run (--interactive)
87+
```
88+
8189
## Step 4: Report Results
8290

8391
Summarize the test outcome:

‎.cursor/rules/api.mdc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Public API is tracked via `.api` files generated by the [Binary Compatibility Va
3434
- `SentryAndroidOptions` — Android-specific options
3535
- Integration modules may add their own (e.g. `SentrySpringProperties`)
3636

37-
New features must be **opt-in by default** — add a getter/setter pair to the appropriate options class.
37+
See the `options` rule for how to add and wire up a new option.
3838

3939
### Internal Classes (Not Public API)
4040

‎.cursor/rules/new_module.mdc‎

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ This document outlines the complete process for adding a new module to the sentr
1212

1313
### 1. Create the Module Structure
1414

15-
1. Create the new module, conforming to the existing naming conventions and build scripts
15+
1. Create the new module, conforming to the existing naming conventions and build scripts.
16+
Copy the `build.gradle.kts` of the closest existing integration rather than writing one from
17+
scratch — `sentry-kafka` is a good JVM template, `sentry-android-timber` a good Android one.
1618

1719
2. Add the module to the include list in `settings.gradle.kts`
1820

@@ -27,9 +29,36 @@ ignoredProjects.addAll(
2729
)
2830
```
2931

30-
3. If adding a JVM sample, add E2E (system) tests, following the structure we have in the existing JVM examples.
32+
3. Add a `SENTRY_{MODULE}_SDK_NAME` constant to the `Config.Sentry` block in
33+
`buildSrc/src/main/java/Config.kt`:
34+
35+
```kotlin
36+
val SENTRY_FOO_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.foo"
37+
```
38+
39+
The module's `build.gradle.kts` consumes it in both `buildConfig` and the jar manifest
40+
(`Sentry-SDK-Name` / `Sentry-SDK-Package-Name`) — see `sentry-kafka/build.gradle.kts`.
41+
42+
4. Add the instrumented library to `gradle/libs.versions.toml` and depend on it with
43+
`compileOnly(libs.<lib>)`, so the integration does not force the dependency on users.
44+
45+
5. Register the integration with the SDK so it is reported in the `sdk` payload. Every
46+
integration does this — see `sentry-openfeature/.../SentryOpenFeatureHook.java`:
47+
48+
```java
49+
static {
50+
SentryIntegrationPackageStorage.getInstance()
51+
.addPackage("maven:io.sentry:sentry-{module-name}", BuildConfig.VERSION_NAME);
52+
}
53+
// then, from the constructor:
54+
addIntegrationToSdkVersion("{IntegrationName}");
55+
```
56+
57+
6. If adding a JVM sample, add E2E (system) tests, following the structure we have in the existing JVM examples.
3158
The test should then be added to `test/system-test-runner.py` and `.github/workflows/system-tests-backend.yml`.
3259

60+
`sentry-bom` and the root `build.gradle.kts` need no change — they iterate over subprojects.
61+
3362
### 2. Create Module Documentation
3463

3564
Create a `README.md` in the module directory with the following structure:
@@ -46,22 +75,29 @@ The following tasks are required only when adding a module that isn't a sample.
4675

4776
### 3. Update Main README.md
4877

49-
Add the new module to the packages table in the main `README.md` with a placeholder link to the badge:
78+
Add the new module to the packages table in the main `README.md`. Copy the row of a neighbouring
79+
module and swap the name — Android modules carry a third column for the min API level, JVM modules
80+
do not:
5081

5182
```markdown
52-
| sentry-{module-name} | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-{module-name}/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-{module-name}) | |
83+
| sentry-{module-name} | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-{module-name}?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-{module-name}) |
5384
```
5485

5586
Note that the badge will only work after the module is released to Maven Central.
5687

57-
### 4. Add Documentation to docs.sentry.io
88+
### 4. Add the Module to the Issue Template
89+
90+
Add `- sentry-{module-name}` to the integrations dropdown in
91+
`.github/ISSUE_TEMPLATE/bug_report_java.yml`, or `bug_report_android.yml` for an Android module.
92+
93+
### 5. Add Documentation to docs.sentry.io
5894

5995
Add the necessary documentation to [docs.sentry.io](https://docs.sentry.io):
6096
- For Java modules: Add to Java platform docs, usually in integrations section
6197
- For Android modules: Add to Android platform docs, usually in integrations section
6298
- Include installation instructions, configuration options, and usage examples
6399

64-
### 5. Post release tasks
100+
### 6. Post release tasks
65101

66102
Remind the user to perform the following tasks after the module is merged and released:
67103

@@ -79,10 +115,3 @@ Remind the user to perform the following tasks after the module is merged and re
79115
- Use kebab-case for module names: `sentry-{module-name}`
80116
- Follow existing patterns: `sentry-okhttp`, `sentry-apollo-4`, `sentry-spring-boot`
81117
- For version-specific modules, include the version: `sentry-apollo-3`, `sentry-apollo-4`
82-
83-
## Important Notes
84-
85-
1. **API Files**: Do not modify `.api` files manually. Run `./gradlew apiDump` to regenerate them
86-
2. **Backwards Compatibility**: Ensure new features are opt-in by default
87-
3. **Testing**: Write comprehensive tests for all new functionality
88-
4. **Documentation**: Always include proper documentation and examples

‎AGENTS.md‎

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ The project uses **Gradle** with Kotlin DSL. Key build files:
4040

4141
## Essential Commands
4242

43-
### Development Workflow
4443
```bash
4544
# Format code and regenerate .api files (REQUIRED before committing)
4645
./gradlew spotlessApply apiDump
@@ -50,36 +49,14 @@ The project uses **Gradle** with Kotlin DSL. Key build files:
5049

5150
# Generate documentation
5251
./gradlew aggregateJavadocs
53-
```
54-
55-
### Testing
56-
```bash
57-
# Run unit tests for a specific file
58-
./gradlew ':<module>:testReleaseUnitTest' --tests="*<file name>*" --info
59-
60-
# Run system tests (requires Python virtual env)
61-
make systemTest
62-
63-
# Run specific test suites
64-
./gradlew :sentry-android-core:testReleaseUnitTest
65-
./gradlew :sentry:test
66-
```
67-
68-
### Code Quality
69-
```bash
70-
# Check code formatting
71-
./gradlew spotlessJavaCheck spotlessKotlinCheck
72-
73-
# Apply code formatting
74-
./gradlew spotlessApply
75-
76-
# Update API dump files (after API changes)
77-
./gradlew apiDump
7852

7953
# Dependency updates check
8054
./gradlew dependencyUpdates -Drevision=release
8155
```
8256

57+
To run tests, use the `test` skill rather than composing the Gradle invocation by hand — it
58+
resolves the per-module test task and the unit-test vs system-test split for you.
59+
8360
### Android-Specific Commands
8461
```bash
8562
# Assemble Android test APKs
@@ -102,11 +79,9 @@ make systemTest
10279

10380
## Repository Skills
10481

105-
This repo ships task-specific skills (declared in `agents.toml`, sources under `.agents/skills`). Prefer them over performing the steps manually:
106-
- **`create-java-pr`**: Branch, format, `apiDump`, commit, push, open PR, and add the changelog entry (automates the PR workflow above)
107-
- **`test`**: Run unit or system tests for a module or a specific class
108-
- **`check-code-attribution`**: Verify third-party code attribution on the current branch (see Third-Party Code Attribution below)
109-
- **`btrace-perfetto`**: Capture and compare Perfetto traces for Android performance work
82+
This repo ships task-specific skills, declared in `agents.toml` with sources under
83+
`.agents/skills`. Your harness already lists them with their descriptions — prefer them over
84+
performing the steps manually.
11085

11186
## Module Architecture
11287

@@ -150,8 +125,8 @@ The repository is organized into multiple modules:
150125

151126
### Code Style
152127
- **Languages**: Java 8+ and Kotlin
153-
- **Formatting**: Enforced via Spotless - always run `./gradlew spotlessApply` before committing
154-
- **API Compatibility**: Binary compatibility is enforced - run `./gradlew apiDump` after API changes
128+
- **Formatting**: Enforced via Spotless
129+
- **API Compatibility**: Binary compatibility is enforced. `.api` files are generated, never hand-edited
155130

156131
### Exception Handling
157132

@@ -189,10 +164,9 @@ PR description why the broad catch is necessary.
189164

190165
### Contributing Guidelines
191166
1. Follow existing code style and language
192-
2. Do not modify API files (e.g. sentry.api) manually - run `./gradlew apiDump` to regenerate them
193-
3. Write comprehensive tests
194-
4. New features must be **opt-in by default** - extend `SentryOptions` or similar Option classes with getters/setters
195-
5. Consider backwards compatibility
167+
2. Write comprehensive tests
168+
3. New features must be **opt-in by default** - extend `SentryOptions` or similar Option classes with getters/setters
169+
4. Consider backwards compatibility
196170

197171
### Third-Party Code Attribution
198172
When adapting code from third-party libraries:

0 commit comments

Comments
 (0)