All posts
Forward Development

Next.js 16.5 RC: what to test before you upgrade production

Next.js 16.5.0-rc.0 changes Turbopack's minify order by default and adds an agent-driven CI upgrade flow. Here is what to test on a branch first.

  • Next.js
  • Operations
  • AI
  • Automation

A minor Next.js upgrade usually goes wrong quietly. The build passes, the deploy goes green, and a week later someone notices that a route's JavaScript got heavier or a performance budget check has been failing on a branch nobody was watching. The release that causes this is rarely the one with a headline feature. It is the one that changes a default.

Next.js v16.5.0-rc.0 changes a default. The release notes are short, and two items in them deserve a branch build before 16.5 goes stable: Turbopack's turbopackMinifyBeforeChunking is now enabled by default, and next upgrade gains a --ci mode that registers secrets in your pipeline and asks you to pick a model and effort level. The first changes what your build emits. The second changes what your CI is trusted to hold.

What the release candidate contains

The core changes listed for v16.5.0-rc.0 are:

  • Enable turbopackMinifyBeforeChunking by default (#102520)
  • Set up CI upgrades with next upgrade --ci (#102511)
  • Register the CI upgrade secrets from next upgrade --ci (#102513)
  • Ask for the model and effort in next upgrade --ci (#102512)
  • Write handoff files for CI runs (#102510)
  • Mark @next/mcp as private (#102451)

The rest is release tooling and test fixture housekeeping. The repo also shows 16.5 canaries up to v16.5.0-canary.73, but the RC is the build to evaluate if your question is what 16.5 stable will do to your application.

The notes are PR titles, not documentation. They tell you what changed, not how much it matters for your app. That is the reason to measure it yourself.

Minify-before-chunking changes your build output

The flag name describes the change: Turbopack minifies code before it decides how to split it into chunks, instead of after. The release notes give no numbers and we will not invent any. What follows from the ordering is that chunking decisions get made against minified code, so chunk boundaries, chunk counts and per-chunk sizes can all differ from what the same source produced on your current version.

Different is not the same as worse. But it means anything that depends on the shape of your output needs a second look:

  • Bundle size budgets. If CI fails a build when a route's JavaScript crosses a threshold, expect the numbers to move in either direction. Rebaseline deliberately, not by bumping the limit until the check passes.
  • Chunk-level caching. A different chunk layout means different files and hashes. Returning visitors download more on the first deploy after the upgrade. That is a one-time cost, but schedule the deploy knowing it is there.
  • Anything that parses build output. Bundle analysis scripts, size-report bots and custom tooling that reads the build directory may assume the old layout.
  • Minification-sensitive code. Code that relies on function or class names surviving, or on a particular module evaluation order, is already fragile. A change in when minification runs is the kind of thing that exposes it.

If a regression does appear, the fact that this ships as a named flag suggests it can be set explicitly. Confirm that in the 16.5 documentation before you count on it as a rollback path, and treat an opt-out as temporary. Defaults are where the framework's testing goes.

Compare builds, not release notes

The test is cheap. On a branch:

  1. Build the current production commit on your current Next.js version and save the build output summary and the chunk listing with sizes.
  2. Install v16.5.0-rc.0, change nothing else, and build again.
  3. Diff the two. Look at total JavaScript per route, the largest chunks, and the number of chunks loaded on your highest-traffic pages.
  4. Run your end-to-end suite against the RC build, not the dev server. Minification problems only show up in production builds.
  5. Run Lighthouse or whatever lab tool your budgets use against a preview deploy, on the same pages you baselined.

Keep the upgrade commit free of other changes. If the numbers move, you want exactly one cause.

next upgrade --ci puts credentials in your pipeline

Four of the six core changes build one feature: a --ci mode for next upgrade. From the PR titles, the command sets up upgrades that run in CI, registers the secrets those runs need, asks which model and what effort level to use, and writes handoff files for the runs. A command that asks for a model and an effort setting is configuring an AI agent. This is an agent-driven upgrade flow, and the secrets it registers are what let that agent work in your pipeline.

The release notes do not say which secrets, what scopes they carry or which providers are supported. Read the documentation and the PRs before running it against a real repository. The questions to answer are the same for any automation that holds credentials:

  • What does the secret grant? A model API key is a billing exposure. A repository token with write access is a supply chain exposure. Know which ones this flow registers.
  • Which workflows can read it? Secrets reachable from workflows triggered by forked pull requests are a known failure mode on most CI platforms.
  • What can the agent merge? An upgrade agent that opens a pull request for human review is a different risk from one that can push to a protected branch. Keep it on the pull request side.
  • Who pays and who watches? Model choice and effort level are cost controls. Set them deliberately, and make sure someone sees the bill.
  • What is in the handoff files? They are written for CI runs. Check where they land and whether they belong in the repository.

Our view: automated upgrade pull requests are useful for the same reason dependency bots are. They turn a dreaded quarterly task into a small recurring review. That stays true only while a person reads the diff and the build comparison before merging. This is practical automation, not an autonomous maintainer, and it should hold the narrowest credentials that let it open a pull request. The same rule applies to any AI automation that touches a deploy pipeline.

Running next upgrade by hand does not require any of this. The --ci flow is something you set up, so adopting 16.5 and adopting agent-driven upgrades are separate decisions. Make them separately.

@next/mcp is now private

The RC also marks @next/mcp as private. The notes give no detail. If any of your tooling refers to that package by name, check whether it still resolves after the upgrade.

What to do this week

  • Create a branch, install v16.5.0-rc.0 and run the build comparison above. Record the before and after chunk sizes somewhere the next person can find them.
  • Re-check performance budgets against the RC build and rebaseline only where you understand the change.
  • Do not ship the RC to production. Test on it, and report regressions upstream while they can still be fixed before stable.
  • Decide, in writing, whether your pipeline should hold credentials for automated upgrades, with what scopes, and who reviews the pull requests it opens.
  • Search your tooling for references to @next/mcp.

If you run a large App Router codebase and want a second engineer on the upgrade branch or the CI credential review, this is the kind of work covered by our enterprise Next.js practice. Send the details through /contact and we will tell you plainly whether the RC is worth your time now or whether to wait for stable.

Need this done on a real stack?

Magento 2, Adobe Commerce, migrations to Medusa.js or Vendure, enterprise Next.js, WordPress, and AI automation.

Contact us