# The Agent Knew About the Trailing Slash. I Did Not

> Compile errors are the easy half of a migration. Ask the agent what compiles fine but behaves differently, and it may know something you forgot.

- URL: https://hsalem.com/agent-knew-trailing-slash/
- Author: Hassan Salem (https://hsalem.com/about/)
- Published: 2026-11-29
- Topics: AI, Coding, Software Engineering

"Is it done? The scanner says it is just one version number."

Our CEO sent this on a Friday at 16:40, with a screenshot. A big prospect, a hospital group we chased for four months, had run a security scan on our API before signing. The report had one red line: our backend runs on Spring Boot 2.7, which has no open source support anymore. Their security review call was on Monday at ten.

Under the screenshot he added: "I asked ChatGPT. It says the upgrade takes five minutes."

I did not laugh. Mostly because a small part of me wanted to believe it too.

## Five minutes, 140 files

Our backend is a Kotlin Spring Boot service, around four years old. Not huge, not small. I know the upgrade from 2 to 3 is never one line. Java 17 minimum, `javax` becomes `jakarta`, Hibernate 6, renamed properties. I did it twice before, by hand, and both times it took more than a week.

But it was Friday, and I had an agent. So I opened a branch and wrote: "Upgrade this project to Spring Boot 3. Make it compile and keep the tests green."

Twenty minutes later it was still working. It had bumped the version, then replaced `javax` with `jakarta` everywhere. Everywhere is the important word. 140 files. Including `javax.crypto.Cipher` in the class that encrypts our refresh tokens, and `javax.sql.DataSource` in the reporting config. Those are part of the JDK. They never moved. There is no `jakarta.crypto`.

The build had 37 errors. The agent started to fix them one by one. It fixed the crypto import, then a Hibernate type mapping, then it changed the crypto import back, because a test helper did not compile anymore. I watched the error count: 37, 29, 31, 26, 30.

I stopped it. I was annoyed, and to be fair, more with me than with the agent. I gave it a task that needs a map, and I asked it to just start walking.

## I asked for the map, not the walking

I threw the branch away and opened a fresh session. This time, no code:

```
Do not change any files.
We are moving a Kotlin service from Spring Boot 2.7 to 3.x.
1. How do experienced teams do this migration?
   Which tools exist for the mechanical part?
2. List the changes that do NOT cause a compile error
   but change behavior at runtime.
3. For each one, tell me how I can check if it affects this repo.
```

The answer felt like a different agent. Same model, same repo. But now it was useful the way a very well read colleague is useful.

For the mechanical part it suggested the OpenRewrite recipe for Spring Boot 3, which does the `jakarta` change with real type information, not with text search. And it suggested adding `spring-boot-properties-migrator` for one run, because it logs every renamed property at startup. I knew OpenRewrite exists, but I never used it for this. The migrator I knew too. In that Friday mood I had simply forgotten it.

Then came the list of silent changes. Most of them I knew. Number three I did not think about at all:

> "Spring Framework 6 no longer matches trailing slashes by default. A request to `/api/v1/shifts/` will not reach a controller mapped to `/api/v1/shifts`. It will return 404. Check your access logs for requests that end with a slash."

Our controllers had no tests with trailing slashes, of course. Why would they.

I asked Mira, who does ops and support for us, to pull one day of access logs. She sent them in ten minutes, together with a fair question: "What am I looking for?" Paths that end with a slash, I said. She found around 1,900 requests. All from our old mobile app, version 1.x. Some nurses still use it, because their phones are managed by hospital IT and update slowly. The new app does not add the slash. The old one does, and on the most important endpoint we have: the shift list.

So after a quick upgrade, every nurse with the old app would open it on Monday morning and see an empty schedule. On the same Monday we wanted to sign a hospital group.

> The compile errors were the easy half. The agent was most useful when I asked about the half that compiles fine.

## Saturday, the boring way

On Saturday morning I ran the OpenRewrite recipe on a new branch. It changed the imports correctly and did not touch `javax.crypto`. The properties migrator printed three warnings at startup. One of them was `spring.redis.host`, which is `spring.data.redis.host` now. Without that warning our cache would try to connect to localhost. On staging that fails loud. On a developer laptop with a local Redis, it looks totally fine.

Then I gave the agent small jobs. Fix the remaining Hibernate 6 errors, one module at a time, and show me the diff before the next module. Write a test that calls the shift endpoint with a trailing slash. The test was red. Good. Then the fix, which is deprecated, and I am fine with that for now:

```kotlin
@Configuration
class LegacyAppPathConfig : WebMvcConfigurer {

    // Old mobile app 1.x calls /api/v1/shifts/ with a trailing slash.
    // Remove this when 1.x is gone from the access logs.
    @Suppress("DEPRECATION")
    override fun configurePathMatch(configurer: PathMatchConfigurer) {
        configurer.setUseTrailingSlashMatch(true)
    }
}
```

The agent first wanted to add a second mapping with a slash on every controller. Thirty annotations. I said no, one place, easy to delete later. It agreed and wrote the config above, and the test with it.

By Saturday evening the branch was green and running on staging. Mira tested with the old app on her own phone. The shifts were there.

## Monday, and the honest answer

On Monday before the call I sat with our CEO for fifteen minutes. He wanted to tell them "done". I asked him not to.

I told him: the code is ready, it runs on staging, and we found one thing that would have broken the app for real users. But I don't put a framework upgrade into production on the morning of the biggest call of the quarter. My suggestion: tell them the upgrade is tested and goes live on Wednesday, and send the plan in writing.

He was not happy, for maybe one minute. Then he asked a good question: "Would the five minute version have broken the nurses' app?" I said yes, very likely. He was quiet for a moment. Then he said he wants to tell this in the call, as proof that we think about their staff and not only about the scanner. I think it worked. They accepted the date.

It went live on Wednesday. One Grafana panel went empty, because a metric tag changed its name. That was on nobody's list, not mine and not the agent's. Ten minutes to fix. The rest was calm.

## What I do now with migrations

1. **Ask for the known path before any code.** "How do experienced teams do this, and which tools exist?" The agent has read every migration guide. Use that knowledge before you use its typing.
2. **Ask for the silent changes, in a separate question.** Compile errors find themselves. Ask "what compiles fine but behaves differently?" and "how do I check it in this repo?"
3. **Give mechanical changes to deterministic tools.** A recipe with type information beats a model doing search and replace over 140 files. The agent does the leftovers, in small steps, with a diff each time.
4. **Check real traffic, not only code.** The trailing slash problem was not in our code. It was in an old app on a nurse's phone. The logs told us, the tests could not.
5. **Give founders a date and a reason, not a "done".** "Tested, live on Wednesday, and here is what we found" builds more trust than a rushed yes.

The funny part: the same agent that broke `javax.crypto` on Friday saved our Monday on Saturday. Nothing changed in the model. Only my question changed.

How do you run upgrades with an agent? Do you let it type first, or do you make it explain first?
