Commit Graph

1854 Commits

Author SHA1 Message Date
Jiwon Choi 5d9ab72cef Add next upgrade --ai and security vulnerability coverage (#98562)
> [!TIP]
> Recommended to review commit by commit.

This PR adds `next upgrade --experimental-ai="security"` flag (alias
`--ai`), which is targeted to help users leverage agents to upgrade
their app to the safe major version when their app's Next.js version has
any security advisories.

Once the command is ran from the user, Next.js will detect the installed
agent harness in user's device, currently limited to Codex and Claude,
and will proceed with starting an agent session once approved. If it is
called within an agent session, the work will continue off within that
agent.

`next upgrade --ai` simply does two things:

- prepare the relevant context to temporary dir
- print hand off prompt, guiding to read those context

The context will guide the agent to run relevant codemods and migration
checklist to proceed. This PR is a base core of the workflow, and will
have wrappers of entry point around this. Also, will add "latest" and
"future" as follow up, which will cover the app to be always latest, and
adopt the future defaults like Cache Components.

This PR also sets up the evals infra and adds evals.
2026-09-18 00:52:20 +02:00
next-js-bot[bot] 65e29e4abe Upgrade React from 019019be-20260911 to ff8f88fc-20260915 (#98693) 2026-09-16 10:14:47 +02:00
next-js-bot[bot] 83cb4fb70f Upgrade React from 6c0e1047-20260908 to 019019be-20260911 (#98576) 2026-09-11 17:58:49 +00:00
Sebastian "Sebbie" Silbermann 1329212686 [ci] Cleanup orphaned next-stats-action (#98348)
Became orphaned in https://github.com/vercel/next.js/pull/97792. Another
script and the test harness needed some utils from `next-stats-action`
so I moved that into `test/lib/link-packed-packages`.
2026-09-10 13:50:36 +02:00
Sebastian "Sebbie" Silbermann 76a0bdbdf4 [scripts] Move scripts (and benchmarks) off of node-fetch (#98347)
We're using Node.js versions with a built-in `fetch` implementation in
all of these scripts.
2026-09-10 13:50:35 +02:00
Sebastian "Sebbie" Silbermann 6ba71046b0 [test] Move the harness off node-fetch (#98195)
Node.js ships with a built-in `fetch` now so `node-fetch` is no longer
necessary. Mostly motivated by tracing Node.js deprecation warnings
which originated from `node-fetch` by calling the deprecated
`url.parse`.

Call sites keep working through a compatibility type on `fetchViaHTTP`
that translates node-fetch-only options: Instead of `agent` we pass to
`http(s)` directly, `timeout` becomes `AbortSignal.timeout`, and Node.js
readable streams are accepted as bodies with `duplex: 'half'` set
automatically.

The `abort-controller` polyfill is dropped since its signal type
predates the current AbortSignal and undici would not honor it.
`node-fetch` stays installed because `scripts/generate-release-log.mjs`,
`scripts/reset-project.mjs`, and `scripts/update-google-fonts.js` still
import it (follow-up material). Fixture apps will be migrated
separately.
2026-09-10 13:50:35 +02:00
Sebastian "Sebbie" Silbermann 9db9b8eff1 Remove tsec (#98423)
tsec enforces nothing today. Of its 22 rules, 16 have no callsite in the
four packages it checks, 5 find violations that are all suppressed by
tsec-exemptions.json, and ban-element-innerhtml-assignments has been
inert since TypeScript dropped the `InnerHTML` mixin from lib.dom.d.ts,
so its matcher resolves to no type. Net enforced findings: zero.

font, third-parties and next-playwright never extended
tsconfig-tsec.json, so they ran all 22 rules over source with no DOM
sinks at all, paying a full extra type-check each for nothing.
2026-09-09 14:57:10 +00:00
next-js-bot[bot] f593b6c80a Upgrade React from f4e439e1-20260902 to 6c0e1047-20260908 (#98363) 2026-09-09 13:30:37 +02:00
Tim Neutkens fb4c498852 Upgrade web-vitals to v6 and report soft navigations (#97232)
## Summary

Upgrades the vendored `web-vitals` dependency to v6.0.1 and enables
soft-navigation reporting for CLS, INP, and LCP. This lets
`useReportWebVitals` report metrics against the navigation where they
occurred, including `navigationURL` for route attribution.

The upgrade also removes the obsolete FID integration and compatibility
patch, regenerates the standard and attribution bundles, and updates the
public metric types and documentation to match the current upstream API.

Related to #97161.

## Verification

- Added production-mode coverage for initial and soft-navigation Web
Vitals reporting with both Turbopack and Webpack.

<!-- NEXT_JS_LLM -->
2026-09-03 09:45:19 +02:00
next-js-bot[bot] 83eabc8f83 Upgrade React from 21c89c9f-20260901 to f4e439e1-20260902 (#98188) 2026-09-03 07:06:44 +00:00
next-js-bot[bot] ec847d8216 Upgrade React from ff7445e6-20260831 to 21c89c9f-20260901 (#98147) 2026-09-02 13:56:20 +02:00
next-js-bot[bot] 9db9c97e6f Upgrade React from 29d9d318-20260826 to ff7445e6-20260831 (#98113) 2026-08-31 18:45:16 +00:00
next-js-bot[bot] 3243c970fc Upgrade React from f789f203-20260825 to 29d9d318-20260826 (#97995) 2026-08-27 20:13:20 +00:00
next-js-bot[bot] 9ce5575a71 Upgrade React from bd6ea412-20260824 to f789f203-20260825 (#97887) 2026-08-26 06:41:54 +00:00
Jude Gao fcf66c3773 Bump @vercel/agent-eval to 2.2.1 (#97885)
Harness bump so the eval grader rewrite in #97826 can run against the
fixed judge.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 20:10:50 +00:00
next-js-bot[bot] b2f3cb6a03 Upgrade React from eafeac09-20260819 to bd6ea412-20260824 (#97812) 2026-08-25 08:01:47 +00:00
Jiwon Choi d7aa66c345 Remove generated error codes (#97687)
### Why?

Should come up with better solution that does not block PRs with git
conflict

x-ref:
https://vercel.slack.com/archives/C02CDC2ALJH/p1785263902728189?thread_ts=1785263687.502649&cid=C02CDC2ALJH

### How?

- Delete `errors.json`, the error-code SWC plugin, generated WASM, merge
driver, and validation/build tooling.
- Stop attaching error codes to server-rendering digests, redboxes, and
telemetry; native `Error.code` and `Error.name` remain available where
applicable.
- Remove the development-overlay error feedback UI, middleware, and
telemetry event that depended on stable codes.
- Update fixtures, snapshots, and guidance for code-free errors and
numeric-only digests.

<!-- NEXT_JS_LLM -->
2026-08-21 22:45:12 +02:00
next-js-bot[bot] 508e563cca Upgrade React from eb8feb71-20260814 to eafeac09-20260819 (#97636)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-08-20 17:07:16 +00:00
next-js-bot[bot] 49e30f66e7 Upgrade React from 22e4f993-20260811 to eb8feb71-20260814 (#97382) 2026-08-14 16:10:30 -04:00
Steven 962ca14d05 fix(deps): bump satori and @vercel/og (#97276) 2026-08-14 07:36:11 -04:00
Sebastian "Sebbie" Silbermann 9e1a290955 Add a script for adopting fork pull requests (#97252)
Fork PRs run without repository secrets, so deploy tests never run on
external contributions. The workaround is to re-push the contributor's
commits to a branch in `vercel/next.js` and open a replacement PR from
there, which is fiddly by hand and carries a real security risk. This
adds a `pr-adopt` PNPM script to encode the procedure.

```bash
pnpm pr-adopt <pr-number>            # adopt
node pr-adopt <pr-number> --dry-run  # report without pushing
```

We copy over the title and body as-is and prepend a `Adopts #N. Closes
#N.` line so that the underlying PR automatically closes and we create
the proper backlinks.

Commits are signed

The description is copied rather than rewritten for two reasons: it is
the contributor's own text, and any `Fixes #123` inside it has to
survive, since the original PR closes unmerged and so never fires its
own.

### The confirmation gate

Adoption runs the contributor's code on a branch where CI has repository
secrets, which is exactly what a fork PR is denied. Anything executing
during install, build, or test can read and exfiltrate them, so before
touching git the script prints the PR link, status, author handle and
association, diff size, and every file touched. Confirming requires
retyping the author's handle, and a non-interactive stdin is refused
rather than silently proceeding.

Two details worth a reviewer's attention:

- **The file list is deliberately unranked.** An earlier revision
flagged "high-risk" paths (`.github/`, `package.json`, lockfiles). That
was removed: a payload can sit in any fixture or source file, and
printing "no high-risk paths touched" manufactures false assurance.
- **The list comes from the paginated REST endpoint.** `gh pr view
--json files` silently caps at 100 entries. #96550 has 106 changed files
and returns 100, which would present a truncated list as the complete
surface. If the count still falls short of `changedFiles` (GitHub stops
at 3000), the shortfall is reported rather than hidden.

Draft and closed PRs are both adoptable, since a contributor may still
be iterating or may have abandoned an unreviewed change; the status is
surfaced rather than enforced. Merged PRs are refused because their
commits are already in `canary`.
2026-08-13 15:52:09 +00:00
next-js-bot[bot] 9690bae79a Upgrade React from 11eddecd-20260805 to 22e4f993-20260811 (#97249)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2026-08-13 10:19:25 +00:00
Niklas Mischkulnig 7916855653 Bump @swc/helpers (#96720)
https://github.com/vercel/next.js/issues/94634#issuecomment-5190067214:
> Module not found: Can't resolve '@swc/helpers/_/_wrap_reg_exp'
> This is on 16.3.0, if that matters. I'm not sure if I understood you
completely, but I want to try your fix before I open a new issue.

That helper was added in March 2026. We had upgraded the swc crates
itself but never upgraded the swc helpers.
2026-08-06 09:09:24 +02:00
next-js-bot[bot] 6f2db21c74 Upgrade React from 7dfc7ccd-20260803 to 11eddecd-20260805 (#96735) 2026-08-05 19:15:09 +02:00
Vercel Release Bot 64571418c3 Upgrade React from cbb046ab-20260731 to 7dfc7ccd-20260803 (#96550)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-08-04 23:03:59 +02:00
Vercel Release Bot f5c81a82c1 Upgrade React from 0f42eac2-20260730 to cbb046ab-20260731 (#96434)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-31 15:27:34 -04:00
Sebastian "Sebbie" Silbermann be7048ef91 Update @types/react and @types/react-dom to latest (#96419) 2026-07-31 11:29:57 -04:00
Vercel Release Bot a49f1c97e6 Upgrade React from 6cb4322d-20260729 to 0f42eac2-20260730 (#96402)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-30 17:21:07 -04:00
Vercel Release Bot 5f5e4773bb Upgrade React from 1724e9ce-20260729 to 6cb4322d-20260729 (#96389) 2026-07-30 17:49:17 +00:00
Vercel Release Bot 769d9e6e03 Upgrade React from 96fcba90-20260728 to 1724e9ce-20260729 (#96355)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-30 13:51:10 +00:00
Joseph 5cdcbbb05b Bump postcss to 8.5.23 (#96107)
Note that https://github.com/advisories/GHSA-6g55-p6wh-862q does not
affect Next.js users unless they build from untrusted source code (which
would have more severe security implications). We're merging this to
reduce noise from security scanners.

- 8.5.21 is 50h+ old so it can be installed
- 8.5.22 is still under 48h - valid at 2026-07-24 08:48:15 UTC 

Closes: https://github.com/vercel/next.js/issues/96349
2026-07-29 18:22:56 -04:00
dan faa3bdf7f1 Bump @types/node to 20.17.7 to fix findSourceMap type (#96321)
Fixes
https://github.com/vercel/next.js/pull/96198#discussion_r3666434724.

Bumps the pinned `@types/node` version to `20.17.7` to get an upstream
fix for `findSourceMap` type.

Also regenerates the pnpm patch due to a conflict.

I upgraded by just a patch because I'm not sure if we rely on being on
an old version here.

## Test Plan

`findSourceMap` now shows correct types.

<img width="694" height="335" alt="Screenshot 2026-07-29 at 01 02 48"
src="https://github.com/user-attachments/assets/cfe740e0-b8bf-4edc-ac27-698f926feb32"
/>
2026-07-29 01:28:48 +01:00
Vercel Release Bot 9ce6d48cd4 Upgrade React from 756fdd47-20260727 to 96fcba90-20260728 (#96306)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-28 15:19:38 -04:00
Vercel Release Bot 8399ee9150 Upgrade React from 28cd4bb0-20260723 to 756fdd47-20260727 (#96270)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-27 15:57:43 -04:00
Sebastian "Sebbie" Silbermann 5d6a82e021 Replace vendored http-proxy with httpxy (#96060)
[`httpxy`](https://github.com/unjs/httpxy) is a faster and actively
maintained variant of `http-proxy`. It also doesn't need any manual
patches to avoid security vulnerabilities in Next.js.

`httpxy` is used by Nuxt and maintained by the Nitro team.
2026-07-27 10:25:54 -04:00
Hendrik Liebau 59cc6420a3 Add a benchmark for dev Cache Components validation on a worker thread (#96152)
This adds `bench/dev-validation/`, wired as `pnpm bench:dev-validation`,
which measures how much dev-mode Cache Components validation contends
for the dev server's event loop during rapid navigation, and how much
running it on a worker thread relieves that. It toggles
`experimental.devValidationWorker` (added in the previous commit) to A/B
the two configurations on the same build. Until the worker
implementation lands the flag is inert and the A/B shows no delta.

The fixture generates one route per family (`client`, `server`,
`sprite`), each nested several layout segments deep under a `(routes)`
route group. Validation renders a combined payload at every URL depth,
so a deeper route means more validation work per navigation, which
mirrors a realistically deep app rather than a single flat segment. The
runner clicks a family's `<Link>` repeatedly, since navigating to the
current route re-renders and re-validates it on every click. The routes
carry no `instant` config because dev validation applies to page
segments by default at the warning level. The three families isolate the
client prerender, the Flight re-encode plus owner-stack work, and the
Flight payload size, respectively.

The signal is browser-observed TTFB taken from Playwright's own network
timing, because it includes the time a request waits for the event loop
while validation monopolizes it. We deliberately do not use the CLI's
logged request durations: the dev server starts that clock inside the
request handler, after the loop has already yielded to the request, so
the queue wait is invisible to it.

The runner prints each configuration's absolute TTFB (p50/p95/max) side
by side rather than a ratio. The time the worker frees is the validation
render's CPU, which is bounded, route-dependent, and does no IO, so a
ratio would overstate a win that does not scale with total request time.
Because the clicks are back-to-back the numbers are a worst case —
navigations that land inside the validation window — and the `max` tail
is the honest headline: it is the main-thread stall the worker removes.
2026-07-25 07:21:03 +02:00
Vercel Release Bot 6c6d1632e1 Upgrade React from 711c445b-20260722 to 28cd4bb0-20260723 (#96100)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-23 23:34:32 +02:00
dan 5f688d274a [Bench] Add client-trace attribution pass and document metrics to render-pipeline (#95828)
Added a bunch of stuff to the bench.

---

**New metrics in the HTTP benchmark**
- Report TTFB per route (time to first body byte), next to total
latency.
- Report each route's document size, how many bytes are inline Flight
payload, and the Flight share.

**New script: `pnpm bench:render-pipeline:client`**
- Loads each route in Chrome with tracing and 4x CPU throttling, and
breaks down where client time goes: evaluating chunks, evaluating inline
Flight scripts, compiling, background parsing, GC, time to hydration,
and blocking time before hydration.
- Also prints FCP/LCP/DOMContentLoaded/load from the same trace, and JS
transferred vs parsed.
- Off by default, separate from the timing benchmark, since tracing
perturbs timing.
- Hydration time comes from a small client component added to the
fixture root layout that calls `performance.mark`.

**Bug fixes**
- The benchmark was replacing the fixture's `next.config.js` with an
empty one during runs.
- If the port was already taken, the benchmark could silently measure
whatever server was already running there. Both scripts now refuse to
start if something is already on the port.
- A server that died on startup used to look like a slow server; now it
errors immediately.
- One failed request used to abort the whole run and throw away all
results. Now it costs one sample and gets counted in `errors`.
- Killing an already-dead server used to hang the script.
- Bad flags now error upfront instead of crashing at the end.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 09:26:03 +02:00
Vercel Release Bot 99cf207aea Upgrade React from 81e442ea-20260721 to 711c445b-20260722 (#96066)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-22 17:41:18 +00:00
Vercel Release Bot cee9824aa5 Upgrade React from 172742b4-20260716 to 81e442ea-20260721 (#96016)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-21 17:25:13 +00:00
Vercel Release Bot c246ba9f07 Upgrade React from 7023f501-20260714 to 172742b4-20260716 (#95901)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-20 01:23:55 +02:00
Vercel Release Bot 8de1af952e Upgrade React from 5123b063-20260708 to 7023f501-20260714 (#95782)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-14 21:43:09 +02:00
Vercel Release Bot 90dd06c240 Upgrade React from df4bd1b4-20260708 to 5123b063-20260708 (#95642)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-09 21:45:06 +02:00
Vercel Release Bot 216c900597 Upgrade React from 12a4baec-20260707 to df4bd1b4-20260708 (#95612)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-09 10:37:34 +02:00
Vercel Release Bot b4b909bc9b Upgrade React from 23def8fd-20260706 to 12a4baec-20260707 (#95581)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-08 09:23:22 +02:00
Sebastian "Sebbie" Silbermann f656c597c6 [fragment-scroll] Enable new scroll handler by default (#95378) 2026-07-06 18:39:07 +00:00
Vercel Release Bot 36b0a4c855 Upgrade React from 3508aee6-20260702 to 23def8fd-20260706 (#95532)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-06 20:11:34 +02:00
Jude Gao 0240fd39a5 evals: fix false-negative regex checks with the agentic LLM judge (#95440)
Fixes false-negative regex assertions — observed rejecting correct
solutions in recent eval runs — by grading those specific checks with
`@vercel/agent-eval`'s agentic LLM judge instead. Only the assertions
with demonstrated false negatives change; every deterministic check
stays.

- `agent-034-async-cookies`: `/await\s+cookies\s*\(\s*\)/` only matched
the naive `await cookies()` and rejected the correct (arguably better)
`await Promise.all([cookies(), headers()])` — observed failing most runs
of a strong model — and the no-sync-call lookbehind wrongly flagged the
bare `cookies()` inside the array. The four await-mechanics tests
collapse into one judge criterion: the promises must actually be awaited
before use, in any correct form. The theme-cookie and Accept-Language
content checks stay regex.
- `agent-030-app-router-migration-hard`: the home-page test rejected
solutions that didn't match one exact shape (e.g. data fetching
extracted to a helper means no literal `fetch(` in `page.tsx`). Its body
becomes one judge criterion (async Server Component, fetches during
server render, no `getServerSideProps`); the file-existence check and
the other seven tests stay deterministic.

The judge is pinned to **`claude-haiku-4-5`** in the generated
experiment configs — a cheap fixed grader, identical for every run
regardless of the model under test. Each criterion states the
requirement semantically, includes one reference solution to ground the
small grader, and fixes the standard of judgment (runtime correctness,
not style) — no enumerated failure modes, so the judge stays flexible
about equivalent forms.

Supporting changes: bumps `@vercel/agent-eval` `0.9.5` → `1.3.0` (ships
the judge runtime) and adapts `run-evals.js` to the 1.3 CLI (`run
baseline agents-md --force`; `--dry` maps to `status`); generated
experiments now run through the Vercel AI Gateway so `vc env pull` is
the only credential setup; converted fixtures exclude `EVAL.ts` from
tsconfig (the `@vercel/agent-eval/eval` import has no type declarations
— vercel-labs/agent-eval#166 — and `next build` type-checks the fixture,
so experiments running `scripts: ['build']` would otherwise fail on it,
same reason `EVAL.tsx` was already excluded). Not converted: `agent-040`
(already redesigned upstream in #94578) and `agent-041` (no diagnosed
false negative in the report).

Verified end-to-end from this repo: converted `agent-034` with codegen
`claude-sonnet-4-5` via the AI Gateway in a Vercel sandbox, judge pinned
to `claude-haiku-4-5` — passes, with the judge clause executing
in-sandbox.

**Running it:**

```bash
pnpm install                 # picks up @vercel/agent-eval 1.3.0
pnpm --filter=next build     # pnpm eval packs the locally built next
vc env pull .env.local       # the only credential: sandbox + AI Gateway (codegen and judge)

pnpm eval agent-034-async-cookies         # baseline + AGENTS.md variants
pnpm eval agent-034-async-cookies --dry   # preview only
```

<!-- NEXT_JS_LLM_PR -->
2026-07-06 12:27:32 -04:00
Sebastian "Sebbie" Silbermann d3169de7e5 Collect modules with browser variants statically (#95200)
Instead of hardcoding the list, we now automatically detect any
`.browser` sibling and create a compiler alias for that module.

Together with a linting rule, we'll ensure no future regressions are
handled automatically (detection of conditional require and missing
.browser sibling).

This isn't the smoothest DX yet. Ideally we'd generate the list at
Next.js compile time (i.e. before publishing) to avoid having to rerun a
script (I'll follow-up). Generating the list during build time (next dev
or next build) is just another tiny cost users would have to pay.
2026-07-03 08:45:23 +02:00
Vercel Release Bot d1268a9084 Upgrade React from ec0fca31-20260701 to 3508aee6-20260702 (#95410)
Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
2026-07-02 20:43:11 +02:00