# Turn Linear Issues Into Pull Requests for a Spring Boot App

An agent adds a pet count to Spring Petclinic's Find Owners list from a Linear-style issue, with a MockMvc test, and ./mvnw test passes 80 tests.

[Run this on Rush](https://cloud.getrush.ai/run/linear-issue-to-pr/spring-boot/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads `src/main/resources/templates/owners/ownersList.html`, the message bundles under `src/main/resources/messages/` and `OwnerControllerTests` before writing anything. The issue asked for a Pets column, but the list already had one: it printed `#strings.listJoin(owner.pets, ', ')`, the names with no count.

So the change stays in the template. A `pet-count` span shows `#lists.size(owner.pets)` and the names follow in parentheses when there are any. `OwnerController` already loads `owner.pets`, so no controller, schema or bundle changes; the column keeps the existing `pets` key. The new test `processFindFormShowsPetCountPerOwner` renders a page with a two-pet owner and a no-pet owner and checks for `2` and `0`.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Implement the Linear issue supplied after this prompt in this Spring Boot application. Read the issue first, then the controller, Thymeleaf template, message bundles and existing tests it touches, and check what the app already does before adding anything. Follow the existing controller, template and message bundle patterns, use the existing data, and add a test in the style of the existing MockMvc controller tests. Run ./mvnw test before and after, and open a pull request linking the issue with the results. If no issue follows this prompt, stop and say so.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

Tried on spring-projects/spring-petclinic at 500158f: with an issue written for the trial, 2 files changed, 21 insertions(+), 1 deletion(-) in `ownersList.html` and `OwnerControllerTests.java`. `./mvnw test` went from `Tests run: 79, Failures: 0, Errors: 0, Skipped: 2` to `Tests run: 80, Failures: 0, Errors: 0, Skipped: 2` and `BUILD SUCCESS`. The first version of the test was too strict about attribute whitespace and failed; the agent matched on a regex instead.

For the reviewer: the count sits in front of the names rather than replacing them; drop the second `<span>` if the issue meant a count alone. The 2 skipped tests are the Testcontainers MySQL and Postgres ones, skipped at baseline because the sandbox had no Docker, and nobody looked at the page in a browser.

## Run it on every Linear issue moved to Ready

An automation with a `linear` trigger on `linear.issue.state_changed` maps the state `Ready` to `exec`, so an issue starts a run once someone in your Rush org moves it there. Mapping `Triage` to `plan` instead starts a read-only run that posts its plan as a comment on the issue first.

## Why run it on Rush?

The issue as written was half wrong: it asked for a column that was already on the page. The run read the template before acting and added only the missing number, leaving the controller, the repository and all the translations alone.

## Frequently asked questions

### Does the count cost an extra query?

No new query was added. The template counts `owner.pets`, which the Find Owners page already rendered as names, so the count uses the data the page loads today.

### What did the run need to install?

The sandbox had no Java, so the agent unpacked a Temurin JDK 17 into a scratch folder and pointed `JAVA_HOME` at it. Maven came from the repository's own `./mvnw` wrapper.

## More Spring Boot jobs

- [Plan a Linear Issue Against a Spring Boot Codebase](https://getrush.ai/run/plan-linear-issues/spring-boot/)
- [Review Pull Requests Automatically in a Spring Boot App](https://getrush.ai/run/review-pull-requests/spring-boot/)
- [Run a Security Audit on a Spring Boot App](https://getrush.ai/run/security-audit/spring-boot/)

## The same job on other stacks

- [Turn Linear Issues Into Pull Requests for a SvelteKit App](https://getrush.ai/run/linear-issue-to-pr/sveltekit/)
- [Turn Linear Issues Into Pull Requests for a Symfony App](https://getrush.ai/run/linear-issue-to-pr/symfony/)
- [Turn Linear Issues Into Pull Requests for a Vue App](https://getrush.ai/run/linear-issue-to-pr/vue/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
