All jobs

Upgrade Angular to the Latest Version

An agent moves an Angular 21 app to 22.2.4 with ng update, fixes what TypeScript 6 broke, and the production build passes before and after.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads package.json first: the Conduit app pins @angular/core 21.2.12, TypeScript ~5.9.3 and installs with bun. On the untouched clone bun run build fails until git submodule update --init fetches the realworld styles, and bun run test --run fails in all 6 spec files because src/test-setup.ts imports zone.js, which is not a dependency.

It runs ng update @angular/core@22 @angular/cli@22, then the Analog Vite plugin and the two @rx-angular packages that ng update also flagged. TypeScript 6 rejects baseUrl, so it deletes it from tsconfig.json, where no paths use it. Analog 2.5.0 crashed vitest with cache.has is not a function, so it goes to 2.9.5.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Upgrade Angular to the latest version with ng update, one major at a time, and apply the migrations it runs. Initialize any git submodules the build needs. Run the project's build and unit tests before and after, and report a test suite that already fails on the untouched code instead of fixing it silently. Leave out any upgrade that breaks the build and say why. Open a pull request listing each bump and every migration-generated change.",
  "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 realworld-apps/angular-realworld-example-app at 77829ef: 6 files changed, 515 insertions(+), 603 deletions(-), most of it a regenerated bun.lock, plus package.json, src/app/app.config.ts, the article template, tsconfig.app.json and tsconfig.json. After the upgrade bun run build printed Application bundle generation complete. [9.834 seconds]. The unit tests did not pass, before or after: Test Files 6 failed (6).

For the reviewer: the migrations added withXhr() to provideHttpClient, because Angular 22 no longer uses the XHR backend by default, wrapped one optional chain in $safeNavigationMigration(...), and suppressed two extended diagnostics. The test setup needs fixing first. With zone.js added temporarily, v21 and v22 both end Tests 180 skipped (180), so the tests say nothing about this upgrade. Playwright e2e was not run.

Run it on every first of the month

An automation with a schedule trigger, cron set to 0 9 1 * *, runs this prompt monthly. Angular ships a major roughly twice a year, so most months the pull request is patch bumps; the month a major lands, it carries the migrations.

The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.

Why run it on Rush?

The run showed the build was the only check that could judge this upgrade: the unit suite was already broken on the untouched clone, and the run proved that on both versions instead of blaming Angular 22. It also caught two breaks ng update itself did not fix, TypeScript 6's baseUrl refusal and an Analog plugin too old for the new vitest.

Frequently asked questions

Why did it not add zone.js to make the tests run?

It tried, without saving it. Both the v21 and v22 trees then failed with 180 tests skipped, so adding it would only have moved the failure. The agent flags what looks like a zoneless-versus-zone.js mismatch in src/test-setup.ts for the code owner to fix.

Was any upgrade left out?

No. Every bump kept the production build passing. The two optional CLI migrations, Karma to Vitest and use-application-builder, were skipped because the project already uses both.

More Angular jobs

More jobs like this: Upgrade dependencies weekly

Keep reading