# Upgrade a Rocket App's Cargo Dependencies Every Week

Yes. Once a week an agent bumps your Rocket server's crates in groups, tests each group with every database feature CI uses, and opens one pull request.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-cargo-dependencies/rocket/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads `Cargo.toml`, `Cargo.lock` and `rust-toolchain.toml` before touching anything. In a Rocket server like dani-garcia/vaultwarden the manifest is edition 2024 with `rust-version` 1.97.1, while the toolchain file pins channel 1.99.0 with `rustfmt` and `clippy`; the two matter separately, because `.github/workflows/build.yml` builds once on each. The web stack is `rocket` 0.5.1 with default features off and `json` and `tls` on, plus `rocket_ws` 0.1.1; storage is `diesel` 2.3.13 with `diesel_migrations` 2.3.2 and `diesel-derive-newtype`; around them sit `tokio` 1.53.2, `reqwest` 0.13.5, `lettre` 0.11.23, the three `webauthn-rs` 0.5.5 crates, `openidconnect` 4.0.1, `jsonwebtoken` 11.1.0, `governor` 0.10.4, `argon2` 0.6.0, `handlebars` 6.4.4 and `opendal` 0.59.4 behind the `s3` feature. The lock resolves 631 packages. `build.rs` refuses to compile unless at least one of `sqlite`, `mysql` or `postgresql` is enabled, so every command the agent runs carries a feature list.

It then sorts upgrades into groups that move together, because this manifest has crates that share types. Patch and minor moves inside the existing ranges come first with `cargo update`, one commit. Then manifest bumps: `rocket` with `rocket_ws`; `diesel` with `diesel_migrations` and `diesel-derive-newtype`; `tokio` with `tokio-util` and `futures`; `reqwest` with `hickory-resolver` and `cookie_store`; `lettre` with `email_address`; the three `webauthn-rs` crates; `openidconnect`; `opendal` with the `aws-*` and `reqsign-*` crates the `s3` feature pulls in; and every remaining crate on its own. Where a new major changes an API, the agent ports the call sites in the same commit, touching only the files the compiler names, under `src/api/`, `src/db/`, `src/auth.rs` or `src/mail.rs`.

Each group is checked the way CI checks it. `[workspace.lints.rust]` sets `warnings = "deny"` and the clippy `pedantic`, `complexity`, `perf`, `style` and `suspicious` groups to warn, and the workflow adds `RUSTFLAGS=-Dwarnings`, so a deprecation notice from a newer crate is a build failure, not a hint. The agent runs `cargo test --profile ci --features sqlite` first for speed, since `libsqlite3-sys` is bundled, then the full line the workflow runs, `cargo test --profile ci --features sqlite,mysql,postgresql,enable_mimalloc,s3`, after installing `libmariadb-dev-compat` and `libpq-dev` as the workflow does, then `cargo clippy` with the same features and `cargo fmt --all -- --check`. A group that fails any of these is reverted and its error recorded; a crate whose new version raises the minimum Rust past 1.97.1 is skipped, because the `msrv` job in the matrix would fail even if the toolchain job passed.

The `playwright/` directory holds end-to-end scenarios on Playwright 1.60.0 that start the server with Docker Compose and a mail catcher. The agent runs them when the sandbox can bring those services up and reports the result; when it cannot, the pull request says so rather than implying they passed. It then opens one pull request with one commit per group, a line per bump with old and new versions, the files each port touched, and every upgrade left out with the reason.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Upgrade this Rocket server's Cargo dependencies for the week. Read Cargo.toml, Cargo.lock, rust-toolchain.toml and .github/workflows/build.yml first, and note that build.rs requires at least one database feature. Start with cargo update for moves inside the current ranges, then bump manifest versions in groups: rocket with rocket_ws; diesel with diesel_migrations and diesel-derive-newtype; tokio with tokio-util and futures; reqwest with hickory-resolver and cookie_store; lettre with email_address; the webauthn-rs crates together; openidconnect; opendal with the aws and reqsign crates; then each remaining crate alone. Port call sites a new major breaks in the same commit, touching only files the compiler names. After each group run cargo test --profile ci --features sqlite, then the full CI line with sqlite,mysql,postgresql,enable_mimalloc,s3 after installing libmariadb-dev-compat and libpq-dev, then cargo clippy with those features and cargo fmt --all -- --check, all with RUSTFLAGS=-Dwarnings. Revert any group that fails and record the error. Skip any crate that raises the minimum Rust version above the manifest's rust-version. Run the Playwright scenarios under playwright/ if the sandbox can start their compose services, and say whether you did. Open one pull request with one commit per group, old and new version for every bump, the files each port touched, and every skipped upgrade with its reason.",
  "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

What comes back is one pull request with a commit per group. `Cargo.toml` and `Cargo.lock` change in every commit; source files change only in the commits whose crate needed a port, and the description names them. The description has a table with each bump's old and new version, a line for each group that was reverted with the compiler or test error that caused it, and the list of crates held back for the minimum Rust version.

The repository's own workflows run on the pull request: `Build` with its `rust-toolchain` and `msrv` matrix, the six `cargo test --profile ci` feature combinations, clippy and `cargo fmt`, plus the `hadolint`, `trivy`, `typos` and `zizmor` checks. The session transcript, read at `GET /o/{org}/sessions/{id}/messages`, keeps every `cargo` command the agent ran with its output, so a reviewer can see the failing group's error text instead of taking the revert on faith.

Before merging, a reviewer reads the ported commits closely, especially anything under `src/auth.rs` or `src/api/` that a `rocket`, `jsonwebtoken` or `webauthn-rs` bump touched, and checks that `docker/DockerSettings.yaml`, which reads `rust_version` from `rust-toolchain.toml`, still matches if the toolchain moved. A group that should not land is one `git revert` away, because it is one commit.

## Run it on every Monday morning

Create an automation in the Project with this prompt and a `schedule` trigger, `cron` `0 9 * * 1` in your `timezone`. The first run catches the manifest up; each later week opens one pull request with that week's bumps, or none when nothing moved. The automation's `max_runs_per_hour` caps how often it can start, and a run that ends with no safe group opens no pull request and says why in its result.

To have the link reach your server instead, start the weekly run from your own scheduler with `POST /o/{org}/sessions` and an API key that has a `webhook_url`: Rush then POSTs `run.completed` with the `session_url` and the agent's summary when the turn ends, and a handler on your side can post the pull request link where the maintainers read.

## Why run it on Rush?

A manifest this size is slow to upgrade by hand because every attempt is a full build with three database drivers, and because `-Dwarnings` turns each deprecation in a new crate into a stop. On a laptop that is an afternoon of waiting on `cargo` between edits. In a Rush sandbox the agent has its own machine for it, installs the MariaDB and Postgres client libraries the workflow needs, runs the six feature combinations in sequence, and your checkout never changes.

The pull request arrives with proof rather than a promise. Each group is its own commit with its own build result in the transcript, so a reviewer can accept the `tokio` bump and drop the `openidconnect` one without untangling a single large diff. And because the run happens weekly, the groups stay small: a few minors most weeks, instead of a once-a-year port across a dozen majors at once.

## Frequently asked questions

### Why groups instead of one cargo update?

Because several crates in this manifest share types and must move together or not at all: `rocket` and `rocket_ws`, `diesel` and `diesel_migrations`, `reqwest` and `cookie_store`, `opendal` and the `aws-*` and `reqsign-*` crates behind the `s3` feature. Grouping also makes the pull request reviewable: one commit per group, so dropping a bump before merge is a revert of one commit.

### What about the minimum supported Rust version?

`Cargo.toml` sets `rust-version` 1.97.1 and the `Build` workflow has an `msrv` job that compiles on exactly that. A crate whose new release needs a newer Rust would pass on the pinned 1.99.0 toolchain and fail there, so the agent skips it and lists it in the pull request. Raising the MSRV is a separate decision for the maintainers.

### Does it test with MySQL and Postgres or only SQLite?

Both. The quick loop uses `--features sqlite` because the bundled `libsqlite3-sys` needs no server, but every group that survives is then built and tested with the workflow's full line, `sqlite,mysql,postgresql,enable_mimalloc,s3`, which needs only the client libraries to compile. The unit tests do not open a database connection, so no server is required for `cargo test`.

### Will it bump the Rust toolchain too?

Not unless you ask. `rust-toolchain.toml` is read by the workflow and by `docker/DockerSettings.yaml` to pick the builder image, so moving it changes the Docker build as well. The prompt on this page limits the run to crates; add a sentence to have it propose a toolchain bump as its own commit with the Docker template change beside it.

### What if a port is too large for one run?

The agent reverts that group, records the compiler errors it hit, and leaves the rest of the pull request intact. Its final message names the crate and the modules that would need work. You can send a follow-up to the same session asking it to attempt that one crate on a separate branch, with the parked sandbox's build cache still warm.

## More Rocket jobs

- [Write Tests for a Rocket Server](https://getrush.ai/run/write-rust-tests/rocket/)
- [Add CORS to a Rocket JSON API](https://getrush.ai/run/add-cors/rocket/)
- [Add Cursor Pagination to a Rocket App](https://getrush.ai/run/add-cursor-pagination/rocket/)

## The same job on other stacks

- [Upgrade Cargo Dependencies in a Rust CLI](https://getrush.ai/run/upgrade-cargo-dependencies/rust-cli/)
- [Upgrade Cargo Dependencies Weekly for a Tokio Service](https://getrush.ai/run/upgrade-cargo-dependencies/tokio/)
- [Upgrade Cargo Dependencies Weekly for an Actix Web API](https://getrush.ai/run/upgrade-cargo-dependencies/actix/)

## 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/)
