Skip to content

Commit 9ddc427

Browse files
committed
docs(contributing): bring the guide up to date and point agents at it
The release section predated the examples project and the module descriptor, and the Javadoc rule contradicted what doclint enforces. AGENTS.md was the only file agents read and never mentioned the guide, so it now links to it and stops restating the release steps.
1 parent 4239311 commit 9ddc427

2 files changed

Lines changed: 40 additions & 30 deletions

File tree

‎AGENTS.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
This file provides context for AI coding agents working in this repository.
44

5+
Read [CONTRIBUTING.md](CONTRIBUTING.md) first: it carries the rules a contribution is judged against and the release procedure, and it applies to agents exactly as it does to people.
6+
This file covers the mechanics of the codebase and does not repeat them.
7+
58
## Project Overview
69

710
**spotify-web-api-java** is a Java wrapper library for the [Spotify Web API](https://developer.spotify.com/documentation/web-api/). It provides typed request builders and model objects for all Spotify API endpoints.
@@ -98,7 +101,8 @@ It checks that every `SpotifyApi` method has an example, that example file names
98101

99102
### Releasing
100103

101-
The version lives in `pom.xml`, `README.md` and `examples/pom.xml`, and `ci/check-docs.py` fails if the examples fall behind the library.
104+
See the release workflow in [CONTRIBUTING.md](CONTRIBUTING.md#release-workflow-maintainers-only).
105+
Note that the version lives in three files, and `ci/check-docs.py` fails when they disagree.
102106

103107
### Renaming or removing public API
104108

‎CONTRIBUTING.md‎

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ especially because currently only voluntary maintainers and contributors take ca
1515
At the same time it is strongly recommended to follow certain guidelines when making contributions to open source
1616
projects like this one. They ensure fast processing times and stable releases.
1717

18-
It is mandatory to stay as close to the
19-
[Web API Endpoint Reference](https://developer.spotify.com/web-api/endpoint-reference/) as possible. Before changing
18+
It is mandatory to stay as close to Spotify's own API description as possible.
19+
A copy of it is vendored at `spec/openapi.yaml`, and that copy is what `ci/check-docs.py` checks a request's verb, path and deprecation against, so it is the first place to look rather than the
20+
[Web API Endpoint Reference](https://developer.spotify.com/documentation/web-api/reference/). Before changing
2021
anything in the code base, make sure to take one - or more - looks into related files/classes and [the project's
2122
documentation](https://spotify-web-api-java.github.io/spotify-web-api-java/apidocs/). The whole code follows simple
2223
and consistent code conventions for naming rules and alike. Those should be easy to grasp by comparing to the online
@@ -37,10 +38,17 @@ A complete contribution includes the following features:
3738
Make sure that your contribution embeds well into the already existing code. For example, the unified folder/package
3839
structure must be used wherever possible.
3940

41+
The library is an explicit Java module, so a class in a **new** package is unreachable for callers until that package is added to `exports` in `src/main/java/module-info.java`.
42+
The examples are compiled as a separate module against the built library, which is what turns a forgotten `exports` into a build failure here rather than in someone else's project.
43+
4044
### Documentation
41-
Document your source code! It's easy because one can most likely just stick to the online API reference. This is a
42-
requirement. Not because your contributed source code is unreadable. Instead, the aim is to keep the Javadoc complete
43-
and - accompanying this - to keep this project as accessible as possible to developers like yourself.
45+
Document what a reader of the published API reference needs: types, getters and the methods on `SpotifyApi`.
46+
Model builder setters and default constructors deliberately carry no prose, because restating the signature adds nothing that the matching getter does not already say, so Javadoc runs with `doclint` set to `all,-missing`.
47+
48+
What is still enforced is that every reference resolves: a dead `{@link}` fails the build, and the Javadoc step runs in CI before a tag can publish anything.
49+
50+
A new endpoint also needs an example under `examples/` and a link from the index in `README.md`, and a renamed or removed public name needs an entry in `MIGRATION.md`.
51+
`ci/check-docs.py` fails without them.
4452

4553
### Test Coverage
4654
Unit tests help to assure that functionality works. Due to that contribution approval requires them to be included for
@@ -49,40 +57,38 @@ none below. For arrays the length is to be checked.
4957

5058
#### Fixtures
5159
A unit test builds upon JSON fixtures. For code changes, fixture files must only be updated when...
52-
- the online examples change
53-
- the online examples are outdated, compared against the reference description and/or the
54-
[Web API Object Model](https://developer.spotify.com/web-api/object-model/).
60+
- the responses Spotify actually returns change
61+
- a fixture is outdated, compared against the schema for that response in `spec/openapi.yaml`
5562

5663
## Contribution Flow
5764
1. Create a fork from this repository
5865
2. Create a branch in your fork in which you develop your contribution (one branch per feature/fix)
5966
3. Create meaningful and well-separated commits
6067
4. Make sure your contribution follows the contribution guidelines above
61-
5. Create a pull request from your feature branch to the correct branch of this project
68+
5. Create a pull request against the branch the change belongs on:
69+
- `main` carries the current stable line, and is where fixes and dependency updates for the released version go
70+
- `beta` accumulates the next pre-release, and is where anything that changes the public API belongs, breaking changes and new endpoints alike
71+
72+
Nothing reaches `main` from `beta` except through the release pull request, so a change that cannot ship in a patch release belongs on `beta` even when it looks small. Ask in the issue if you are unsure.
6273

6374
## Release Workflow (Maintainers Only)
6475

6576
Follow these steps to publish a new release:
6677

6778
### 1. Update version numbers
6879

69-
Update the version string in **three places**:
80+
The version lives in **three files**:
81+
82+
- **`pom.xml`** — the `<version>` element near the top
83+
- **`README.md`** — two occurrences, the Maven `<version>` snippet and the Gradle `implementation` line
84+
- **`examples/pom.xml`** — the examples are a separate Maven project, so they carry their own copy
7085

71-
- **`pom.xml`** — the `<version>` element near the top of the file:
72-
```xml
73-
<version>X.Y.Z</version>
74-
```
75-
- **`README.md`** — two occurrences: the Maven `<version>` snippet and the Gradle `implementation` line:
76-
```xml
77-
<version>X.Y.Z</version>
78-
```
79-
```groovy
80-
implementation 'se.michaelthelin.spotify:spotify-web-api-java:X.Y.Z'
81-
```
86+
`ci/check-docs.py` fails the build when `examples/pom.xml` falls behind `pom.xml`, so a missed bump is caught rather than shipped.
8287

8388
### 2. Regenerate Javadoc
8489

85-
The `apidocs/` directory at the project root is the published API documentation and must be regenerated on every release. The `release` Maven profile is configured to delete `apidocs/` and regenerate it.
90+
The `apidocs/` directory at the project root is the published API documentation and must be regenerated on every release.
91+
The `release` profile deletes and regenerates it, and because the library is an explicit module, Javadoc writes the pages under `apidocs/se.michaelthelin.spotify/`.
8692

8793
Run:
8894
```bash
@@ -96,23 +102,23 @@ This will:
96102

97103
### 3. Commit and tag
98104

99-
Commit all changed files (version bumps + regenerated `apidocs/`):
105+
Pre-releases are cut from `beta` and tagged `X.Y.Z-RCN`; stable releases are cut from `main` and tagged `X.Y.Z`. CI reacts to both patterns and to nothing else.
106+
107+
Commit the version bumps together with the regenerated documentation:
100108
```bash
101-
git add pom.xml README.md apidocs/
109+
git add pom.xml README.md examples/pom.xml apidocs/
102110
git commit -m "X.Y.Z"
103111
```
104112

105-
Create a lightweight Git tag matching the version exactly (the CI tag pattern is `X.Y.Z` or `X.Y.Z-RCN`):
113+
Create a lightweight tag matching the version exactly, and push the commit before the tag so CI validates the code before it publishes anything:
106114
```bash
107115
git tag X.Y.Z
108-
```
109-
110-
Push the commit and tag:
111-
```bash
112116
git push origin <branch>
113117
git push origin X.Y.Z
114118
```
115119

120+
A pre-release line becomes stable by merging `beta` into `main` through the release pull request and tagging there. That merge is also what publishes the documentation, since GitHub Pages serves from `main`.
121+
116122
### 4. Automated release via CI
117123

118124
Pushing a tag triggers the GitHub Actions CI workflow (`.github/workflows/ci.yml`), which automatically:

0 commit comments

Comments
 (0)