- 30 Oct, 2026 10 commits
-
-
next-js-bot[bot] authored
-
Tobias Koppers authored
### What? Fixes the canary build. `turbopack-core` doesn't compile since #100928 merged: ``` error[E0599]: no method named `get_index` found for struct `Vec<ChunkGroup>` in the current scope ``` ### Why? This is a semantic merge conflict: - #100935 changed `ChunkGroupInfo::chunk_groups` from an `FxIndexSet<ChunkGroup>` to a `Vec<ChunkGroup>`. - #100928's `ChunkGroupInfo::chunk_group_at` was tested on a base without that change. It still calls `get_index`, which exists only on `IndexSet`. ### How? Use `Vec::get`. It returns the same `Option<&ChunkGroup>`, so the error context and behavior stay the same. No other code has `IndexSet`-only calls on `chunk_groups`. Verified locally with `cargo fmt --check` and with `cargo check -p turbopack-core --all-targets` under `-D warnings`. <!-- NEXT_JS_LLM --> <!-- fleet 4f67c6f7-bbe2-454b-9a17-822a60ef8f7e --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
-
Niklas Mischkulnig authored
Reverts #100898 Reapplies #100705
-
Tobias Koppers authored
### What? In `next dev` with Turbopack lazy dynamic imports (`experimental.turbopackLazyDynamicImports` and/or `turbopackLazyDynamicImportsSSR`), apps with nested `React.lazy(() => import(...))` client components log Rust panics while lazy imports activate: ``` thread 'tokio-rt-worker' panicked at turbopack/crates/turbopack-core/src/module_graph/chunk_group_info.rs:111:51: index out of bounds: the len is 31 but the index is 31 ``` The dev server recovers and pages render, but the output is noisy and the panics hide real errors. This PR turns that out-of-range lookup into a contextual, transient error and adds regression coverage. It doesn't touch #100705 or canonicalization (#100705 was reverted in #100898). The panic happens on canary without it. ### Why? `compute_chunk_group_info` creates the `module_chunk_groups` and `chunk_group_indices` child cells with `ResolvedVc::cell(...)` while it builds the result, and creates the outer `ChunkGroupInfo` cell, which holds `chunk_groups` inline, at the end. Each cell is published when it is written (`turbo-tasks-backend/src/backend/operation/update_cell.rs`). So while lazy activation recomputes the graph, an eventually consistent reader of `get_chunk_groups_for_module` (or `get_chunk_group`) can pair the **old** inline `chunk_groups` with a **new** child cell. If the new graph has more chunk groups, `self.chunk_groups[index]` is out of range. I confirmed this with temporary instrumentation that wasn't committed, on a fixture like the new test: - 34 `compute_chunk_group_info` executions. Each was internally consistent (max index = len − 1). - 1147 reads, of which 59 paired cells from different executions. 3 were out of range (the panics), and 56 had in-range indices. - For all 26 affected modules, the last read was consistent and newer than every torn read. The reader depends on both cells and is recomputed, so strongly consistent consumers end up with the correct result. ### How? - `ChunkGroupInfo::chunk_group_at` replaces direct indexing in `get_chunk_groups_for_module` and `get_chunk_group`. - An index from a child cell that the inline `chunk_groups` doesn't have becomes an `anyhow` error with context, never an empty or partial result. - The dependencies and keyed reads are the same as before. - **This is a guard, not a consistent snapshot.** Torn reads with in-range indices are still possible in the middle of a recomputation, and they are corrected by recomputation as before. Making them impossible needs coherent publication or snapshot identity across the cells, which is a separate design. **Tests** - `test/development/app-dir/lazy-dynamic-nested-imports`: nested `React.lazy` imports with `x` reached from `a`, `c` and `y`, with both lazy flags enabled. - Checks every level in the SSR HTML. - Hydrates every level in the browser with `retry()`, and asserts that no request returns ≥ 400 and that there are no transport errors. Browser cancellations (`net::ERR_ABORTED`) are ignored; they happen without this change too. - Asserts that the CLI output contains no `panicked` and no `⨯`. - Without the fix it fails on the panic assertion (39 panics). With the fix it passed 3 runs in a row. - A deterministic Rust test (`test_chunk_groups_for_module_with_mixed_generation_cells`) pairs a real graph's membership cell with a truncated inline group list. It panics before the fix and returns the error after it. **Verification** (on canary `a14cbc44`) - 12 dev sessions of a nested lazy fixture: 2 shapes × client lazy / SSR lazy / both × 2 sessions. All clean: 0 panics, 0 `⨯`, SSR and hydration OK. Before the fix almost every lazy session panicked. - `test/development/app-dir/lazy-dynamic-imports` (19/19) and `lazy-dynamic-chunk-list-collision` (1/1). - `cargo nextest -p turbopack-core -p next-core`: 289 passed. `-p turbopack-tests`: 458 passed, no snapshot changes. fmt, check and clippy pass with `-D warnings`. - Production output is unchanged: for the fixture's 25 client files, path and SHA-256 are identical before and after. **Not fixed here** - A build with extra logging `await`s still hit an SSR `ChunkLoadError` for a lazy proxy chunk in 1 of 3 sessions, with no panic. That is a separate issue that I'm tracking separately. <!-- NEXT_JS_LLM --> <!-- fleet 4f67c6f7-bbe2-454b-9a17-822a60ef8f7e --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
-
next-js-bot[bot] authored
-
Luke Sandberg authored
Order matters, use a vec Using IndexSet gives us 'set equality' semantics (but deterministic iteration order), this is broken for chunk groups and can cause queries that depend on ordering to fail. Since in a wam build if the order of items in a chunk group changes, then we will reuse the old order (the cell update is considered equivalent) I am looking at other places where this is a risk but this one definitely is and is straightforward to fix <!-- I am a human, why would i deceive you? --> --------- Co-authored-by:Claude Opus 5.5 <noreply@anthropic.com>
-
Hendrik Liebau authored
The tests added in PR #100357 can race background fetch-cache writes after the HTTP response completes. The tests now wait for the expected value and `lastModified` timestamp on disk before checking cache reuse, stopping the server, or inspecting the rewritten entry. The first request after tag revalidation must still return fresh data without retries. [Flakiness metrics](https://app.datadoghq.com/ci/ci-cd/explorer/executions?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.name%3A%22file-system-cache-clock%20with%20the%20default%20memory%20cache%20reads%20a%20fetch%20cache%20entry%20written%20without%20a%20stored%20timestamp%22%20%40test.type%3A%22turbopack%22%20%40test.status%3A%22fail%22&agg_m=count&agg_m_source=base&agg_t=count&ci_cd_explorer_tab=tests&fromUser=false&start=1792744453308&end=1793349253308&paused=false)
-
Sebastian "Sebbie" Silbermann authored
If source maps are disabled, we're most likely running in a prod server where sourcemapping happens lazily when logs are inspected. Ignore-listing generated frames would forever hide n_m frames. It also avoids doing a bunch of work that just won't have any effect. As a follow-up, I'll experiment with showing all frames during next-build if all original frames are ignore-listed since that's a one-shot process. For next-dev, we'll continue showing no frames if everything is ignore-listed since you have an attached a debugger with the browser to get a high-fidelity UI to see ignore-listed frames. Co-authored-by:Claude Code <noreply@anthropic.com>
-
Hendrik Liebau authored
-
Andrew Clark authored
REVIEW.md told the review agent to approve only PRs "from human authors on the Next.js team". Neither half of that was something the agent could check. It had no list of who is on the team, and it has no way to confirm that the person behind a GitHub account is human. Taken literally, the second condition can never be met, so the agent intermittently withheld approval from PRs it would otherwise approve, citing that it couldn't prove the author was human. The team is now defined as the owners listed in review/OWNERS, which the agent can check directly and which scripts/review-context.mjs already treats as the team when picking default reviewers. Bots and outside contributors aren't on that list, so excluding them no longer needs a separate "human" condition. The rule also now says outright that a team member's account stands for that person. The agent shouldn't try to prove the author is human, and it shouldn't withhold approval because a PR was written with an AI agent, which is the same refusal in another form.
-
- 29 Oct, 2026 17 commits
-
-
next-js-bot[bot] authored
-
Luke Sandberg authored
More than once i have been blocked by the the vscode sandbox when attempting to read a trace file, now we print the PermissionDenied error so this is easier to diagnose a client disconnect also gets a simpler error message, these are not a big deal
-
Aurora Scharff authored
## Summary - document that Proxy does not transform `use cache` or `use server`; functions still execute, but directive semantics do not apply - explain that `use cache` output is neither cached nor deduplicated in Proxy and that `cacheLife` throws without a cache scope - clarify that hosting providers can replace the default cache handler or disable runtime storage, while concurrent calls can still be deduplicated - point Proxy users to an external cache or data store, or to a supported application context such as a Server Component or Route Handler Affected documentation: - `docs/01-app/01-getting-started/16-proxy.mdx` - `docs/01-app/03-api-reference/03-file-conventions/proxy.mdx` (also supplies the Pages Router Proxy reference) - `docs/01-app/03-api-reference/01-directives/use-cache.mdx` - `docs/01-app/03-api-reference/01-directives/use-server.mdx` Related to #85475. Finding: https://next-maintainer-agent.vercel.tools/agent-feedback/5487 ## Verification - Prettier 3.6.2 check on the changed MDX files - `git diff --cached --check` before committing - Not run: test suite (documentation-only change) <!-- NEXT_JS_LLM --> --------- Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com> Co-authored-by:
Joseph <sephxd1234@gmail.com>
-
Tobias Koppers authored
Reverts vercel/next.js#100705
-
Luke Sandberg authored
### What `new Response(body, { status })` throws `Invalid response status code 204` for null body statuses (204, 205, 304) whenever `body` is non-null, and that includes an empty buffer. A few places buffer a response with `arrayBuffer()` and rebuild it, which turns a body-less response into an empty buffer: - **Route handler prerender with `cacheComponents`** (`app-route/module.ts`). The throw happened inside a `.then` callback whose rejection nothing handled, so the prerender promise never settled. Any route handler returning 204, including the auto-implemented `OPTIONS` handler, hung until the function timeout, and a GET returning 204 hung `next build`. We hit this on nextjs.org: every `OPTIONS /feed.xml` logged an `unhandledRejection` and then a 60s `Vercel Runtime Timeout Error`. - **Serving a cached app route response** (`build/templates/app-route.ts`), which rebuilt the response from the stored body and returned a 500. This runs on Vercel too, right after generation, so fixing only the prerender path would have turned the timeouts into 500s. - **Fetches deduped through `workStore.pendingRevalidates`** (`patch-fetch.ts`). The origin response is buffered for any status, so when it was a 204, every waiting caller after the first threw. ### How - On the in-memory paths (the route handler prerender and both `pendingRevalidates` producers), check `body === null` on the original response and skip `arrayBuffer()` entirely, so nothing is read or allocated. The route handler prerender also now uses `.then().catch(reject)`, so a future throw there rejects instead of hanging. - Serving a cached route response checks the status with a new `isNullBodyStatus` helper. The stored format (`.body` file, `CachedRouteValue.body: Buffer`) stores a missing body as zero bytes, so only the status can tell them apart. I left the format alone because custom cache handlers and existing entries depend on it. The fetch cache itself only stores 200 responses, so a fetch cache hit and `createCachedPrerenderResponse` can't see a 204 and are unchanged. ### Tests - `use-cache-route-handler-only`: a GET returning 204. Without the fix, `next build` hangs on it and gets killed. - `use-cache-route-handler-only`: auto-implemented `OPTIONS` on a `'use cache'` route, deploy-only. `next start` answers non-GET/HEAD requests to prerendered routes with a 405 before the handler runs, while Vercel invokes the function, which is how production reached the prerender path. Not run locally. - `patch-fetch.test.ts`: two concurrent identical fetches during a foreground revalidate, with the origin returning 204. Without the fix, this throws. <!-- NEXT_JS_LLM --> -
Hendrik Liebau authored
The tests verify that an embedded runtime prefetch reuses a valid handler entry after tag revalidation invalidates the old Resume Data Cache entry. They also verify that a server action returns a shared value and completes its re-render when the producer's handler write fails. These tests cover existing behavior that the `use cache` wrapper rewrite in #100511 must preserve.
-
Jimmy Miller authored
Use the same analyzed references for facade graph traversal and code generation so pruned evaluation fragments cannot leave dangling imports. Add a regression test for a client reexport of a side-effect-free barrel.
-
Sam Selikoff authored
Metadata routes like `robots.ts` and `sitemap.ts` were emitted as static files even when they had revalidation configured, so adapter deployments could never refresh them. Keep revalidating metadata as prerenders backed by app routes. Compute static-file eligibility once so the two output decisions stay in sync. Related to #100782. <!-- NEXT_JS_LLM -->
-
Sebastian "Sebbie" Silbermann authored
Otherwise Vercel default for new projects is used which is latest Node.js. This could cause random breakages if not everything is future compatible. We can later use the same setup to configure runs to use newer Node.js versions (e.g. on a schedule to test future compat). ## Verification - Full deploy run: https://github.com/vercel/next.js/actions/runs/40861798132 -> [Example deployment with Node.js override](https://vercel.com/vtest314-next-adapter-e2e-tests/vtest314-e2e-tests/DVip99zHRvi6EVDiiFs7S6jcK97U) <!-- NEXT_JS_LLM --> --------- Co-authored-by:
Claude Code (kimi-k3[1m]) <noreply@anthropic.com>
-
Tim Neutkens authored
`create-next-app` no longer asks "Would you like to use App Router? (recommended)". New projects always use the App Router. **Why** The App Router is the recommended default, and the interactive prompt only offered a way to pick the Pages Router by accident. A saved `app: false` preference from an earlier run also kept silently producing Pages Router projects. **Approach** - Remove the App Router toggle prompt and set `opts.app = true` unless `--no-app` or `--api` is passed. - Drop `app` from the defaults/preferences display, so the "recommended defaults" and "reuse previous settings" summaries no longer list "App Router" / "Pages Router". - Saved `app` preferences are ignored. `--no-app` remains as the explicit opt-out, so the existing Pages templates and their tests are unchanged. **Validation** - `prompts.test.ts`: removed the App Router prompt from the customize flow; the "reuse previous settings" test with a saved `app: false` now expects an `app/` directory. - Type-checked `packages/create-next-app/index.ts` with no new errors. The create-next-app e2e tests were not run locally. **Docs** Removed the prompt line and "App Router" from the recommended defaults summary in the installation guide and the `create-next-app` CLI reference. --------- Co-authored-by:
roboeve[bot] <311457182+roboeve[bot]@users.noreply.github.com> Co-authored-by:
Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
-
Niklas Mischkulnig authored
This will eventually allow better tree shaking Before: ```js const $$RSC_SERVER_CACHE_0_INNER = async function cached() { return expensive() } export var $$RSC_SERVER_CACHE_0 = reactCache(function cached() { return cache('default', id, 0, $$RSC_SERVER_CACHE_0_INNER, []) }) registerServerReference($$RSC_SERVER_CACHE_0, id, null) Object.defineProperty($$RSC_SERVER_CACHE_0, 'name', { value: 'cached' }) ``` After: ```js const $$RSC_SERVER_CACHE_0_INNER = async function cached() { return expensive() } export var $$RSC_SERVER_CACHE_0 = /*#__PURE__*/Object.defineProperty( /*#__PURE__*/registerServerReference( /*#__PURE__*/reactCache(function cached() { return cache('default', id, 0, $$RSC_SERVER_CACHE_0_INNER, []) }), id, null), 'name', { value: 'cached' }) ``` -
Niklas Mischkulnig authored
### What? Fix trailing-slash package-root resolution in Turbopack, including dynamic CommonJS requests with an empty runtime suffix. ### Why? The package-root result could be keyed as a bare package request even when the request included a trailing slash. Dynamic module contexts then lacked the slash-root key and threw `MODULE_NOT_FOUND` for a valid package entry. Exact trailing-slash requests could also resolve the same folder twice through overlapping root and relative-subpath paths. ### How? Resolve matching package roots once while preserving distinct bare and trailing-slash request keys. Only use relative-subpath resolution for patterns that can match deeper paths, leaving package-exports handling unchanged. Add keyed Rust coverage for main/index fallback, exports and dynamic patterns, plus a loader-free execution fixture that distinguishes the package main from index and checks real and missing subpaths. ### Verification - Confirmed the execution regression fails on the unfixed resolver and passes with the correction. - `cargo nextest run -p turbopack-tests --test execution -E 'test(resolving)'` — 33 fixtures passed. - `cargo test -p turbopack-core --lib` — 198 passed; 2 existing ignored benchmarks. <!-- NEXT_JS_LLM --> <!-- fleet 21b5a5ed-fae3-4261-8b72-44936c636deb --> --------- Co-authored-by:vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
-
Tobias Koppers authored
## Summary In development, the dev overlay renders nothing until the HMR `sync` message arrives. That message tells the client whether the dev indicator is disabled, and the client waits for it so a disabled indicator doesn't briefly appear. The error overlay (redbox) sat behind the same check, though. If `sync` was delayed or lost, compile and runtime errors already reached the client state but no redbox was shown. This PR keeps the indicator-readiness check only for the indicator UI, meaning the devtools indicator and its panels. The error overlay and the contexts it needs now render independently of it, so errors show as soon as they are known. When `sync` arrives normally, the indicator behaves the same as before. #100628 removes the server-side cause of a delayed `sync` (waiting on the npm registry version check). This change is independent and protects the overlay from any other delay. A regression test uses Playwright websocket routing to withhold only the `sync` message. For both the app and pages router, it checks that a module-not-found error still shows the redbox and that the devtools indicator stays hidden. ## Verification Run locally with Turbopack dev and webpack dev: - New `test/development/app-dir/dev-overlay-redbox-before-sync`: fails without this change (no redbox) and passes with it. - `test/development/acceptance/ReactRefreshLogBox-builtins.test.ts` - `test/development/acceptance-app/rsc-build-errors-react-apis-1.test.ts` - `test/development/dev-indicator/dev-indicator.test.ts` - `test/development/app-dir/dev-indicator/hide-button.test.ts` <!-- NEXT_JS_LLM --> <!-- fleet 64c837ee-843c-4c4b-b256-57dd903babf5 --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
next-js-bot[bot] authored
This auto-generated PR updates font data with latest available Co-authored-by:next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
-
next-js-bot[bot] authored
-
Tobias Koppers authored
### What? Defer the requires in `packages/next/src/build/utils.ts` that are only needed while collecting page data, so the main `next build` process no longer evaluates them at startup. The deferred modules are the edge sandbox, `load-components`, the incremental cache helper, app segment collection, the app/pages static-path builders and the HTTP agent setup. ### Why? `build/utils` is loaded eagerly by the main process, through `build/index` and through route discovery → `get-page-static-info`. Its top-level imports pulled in large dependency graphs, including `compiled/edge-runtime`, the incremental cache / response cache, the tracer and OpenTelemetry. Those are only used by `isPageStatic` and the component-loading helpers, which run in the build workers. The main process paid for evaluating them before `build()` started, then never used them. ### How? - Each of those dependencies is now `require`d at its call site, keeping the original call order. The types still come from `import type`. - The side-effect imports at the top of the file (`require-hook`, `node-polyfill-crypto`, `node-environment`) are untouched, so initialization order is the same in the main process and in workers. - After the change, the deferred modules are never loaded in the main process for the whole build. The work is removed, not moved inside `build()`. ### Measurements These are local measurements on one machine, alternating base and change runs. `bench/nested-deps-app-router-many-pages` has 1,000 pages and uses Turbopack. The metric is the time from profiler start to the first sample inside `build()`, taken from `next build --experimental-cpu-prof`. | Pair | Before | After | |---|---:|---:| | 1 | 244.7ms | 200.5ms | | 2 | 243.4ms | 184.4ms | | 3 | 255.6ms | 184.6ms | - **Mean:** 247.9 → 189.8ms (−23%). - **Total build time:** unchanged (~52–55s). - **`cli/next-build.js` require time:** median 251.8 → 207.3ms in a fresh process (30 interleaved samples each). - **Main-process modules, whole build of a small mixed app:** - Turbopack: 424 → 348 `next/dist` modules. - Webpack: 551 → 476 `next/dist` modules. ### Verification - **Smoke builds:** a small app with app router, edge, SSG, pages `getStaticProps`/`getStaticPaths` and middleware produces an identical route table before and after, with both Turbopack and webpack. - `pnpm test-start-turbo test/production/app-dir-edge-runtime-with-wasm test/production/conflicting-ssg-paths` - `pnpm test-start-webpack test/e2e/app-dir/app/standalone.test.ts test/production/build-output` - `packages/next/src/build/analysis/get-page-static-info.test.ts` unit tests - **Not run:** a webpack build of the 1,000-page benchmark. It fails during compilation with a native `std::bad_alloc` on the base commit as well, so it is unrelated to this change. <!-- NEXT_JS_LLM --> <!-- fleet 60ff1dd9-ad2b-411e-8a67-e3842d2a1798 --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Tobias Koppers authored
### What? Canonicalize async-loader availability before constructing loaders for dynamic `import()` and `next/dynamic`, so parents that make the same modules available share loader tasks instead of creating them once per page. Lazy-compilation proxies keep their activation paths stable; their actual targets still use canonicalization when their closures contain no further lazy proxies. ### Why? `AsyncLoaderModule` and `async_loader_chunk_item` are keyed by `AvailabilityInfo`. Both the available chunk groups and `entry_group` carry per-parent information. On v0 there are about 196K `async_loader_chunk_item` tasks for a few hundred targets. Intersecting availability with reachable groups alone isn't enough: a module shared with every page, such as `react/jsx-runtime`, keeps that intersection different per page. ### How? - **Precompute observed sets in `compute_chunk_group_info`.** Build a chunk-group graph from async, shared/shared-merged and collected references, then close over it per strongly connected component. For each async target, record the distinct chunk-group sets tested during chunking, their union, and whether it needs `entry_group`. Store this in a keyed cell on `ChunkGroupInfo`. - **Canonical availability.** From the union, remove each observed set that misses the parent availability. The result answers every observed intersection question like the original and depends only on those answers, not the parent. It can include groups not originally available; it is a representative, not a subset. Drop `entry_group` when it cannot be read. - **Filter inline at both call sites.** `AvailabilityInfo::canonicalize_for_async_loader` is used in `make_chunk_group` and next-api's `next/dynamic` loader construction. No filtering task per parent/target; equal resulting bitmaps share a cell. Unknown collected subgraphs conservatively keep the original availability. - **Lazy-compilation boundary.** `LazyCompilationProxyModule` implements the generic `ActivatableModule` marker. The pass stops at its async group and omits that group's narrowing entry, preserving the proxy loader's availability. Deferred references must start independent chunk groups, as documented by the marker. - Async ancestors reaching a proxy use the subset-safe intersection filter and keep `entry_group`, including for collecting modules that appear only on activation. - This prevents invented availability reaching an unknown target and keeps nested proxy stub paths stable when activation expands the graph. - Actual targets with proxy-free closures still canonicalize. Ancestors containing more lazy proxies may remain per-parent; this does not promise full deduplication in lazy mode. - **Distinct manifest names.** Base `ManifestAsyncModule::content_ident` on the manifest module's own ident, not the inner module's ident. Empty availability no longer makes the manifest and inner module collide; the lazy activation key remains part of the path. - **Cached chunk-group identity hashes.** `ChunkGroupInfo::chunk_group_ident_hashes` renders and hashes each chunk-group identity once per graph. `AvailableChunkGroups::hash` then reads that one cell, sorts its members' identity hashes and combines them, instead of rendering every member identity in every availability hash. The second commit fixes two reproducible lazy-import regressions exposed by the initial canonicalization: duplicate output paths and activation 404s. They were not flakes. The third commit addresses the vercel-site cold-build CPU regression found in benchmarks: canonical availability sets were larger, and `AvailableChunkGroups::hash` repeated identity rendering for every member. Output names intentionally change because the set hash now combines per-identity hashes. ### Measurement Measured before rebasing onto canary's `Bitset` migration (#100643, #100630); not re-measured since. Production build of a generated app: N client pages, each using `next/dynamic` on the same five targets with private dependencies; JSX targets additionally share `react/jsx-runtime` with every page. Lazy compilation is off. | Variant | N | `async_loader_chunk_item` tasks | `AsyncLoaderModule::new` tasks | Total tasks | |---|---|---|---|---| | plain | 10 | 100 → 10 | 150 → 15 | 115,052 → 112,153 | | plain | 100 | 1,000 → 10 | 1,500 → 15 | 237,992 → 206,203 | | JSX | 10 | 100 → 10 | 150 → 15 | 115,131 → 112,257 | | JSX | 100 | 1,000 → 10 | 1,500 → 15 | 238,071 → 206,307 | `compute chunk group info` CPU: 2.81 → 3.64 ms at N=100, including 0.75 ms for the new pass. After the lazy fix, quick N=100 runs of both variants still produce 10 loader tasks and 15 loader-module tasks. **No established build-wall-time gain:** the small synthetic app's timings overlap. Not measured on v0. After the third commit, on the JSX app at N=100, availability-hash task executions stay at 5, the new graph task runs once, and `AssetIdent::to_string` calls fall from 13,014 to 11,247 in both runs. One trace per arm reduces total `AvailableChunkGroups::hash` span CPU from 3.10 ms to 1.72 ms, including the first identity-hash computation. Real-app benchmarks have not been rerun after this commit. ### Verification - Unit coverage: disjoint and shared targets; nested async/shared/merged references and cycles; isolated/traced references; collect/emit and entry-group decisions; keyed-cell invalidation; exhaustive canonical and subset-filter properties. - Activation regression test compares inactive/active graphs by chunk-group keys, checks stable subset availability and retained `entry_group` above a proxy, unchanged proxy availability, and canonicalization of activated and unrelated targets. - New `collect/async` execution fixture. - Lazy dev suites: `lazy-dynamic-imports` (19/19), `lazy-dynamic-chunk-list-collision` (1/1), and collision again with cache components and cached navigations (1/1). - Focused Turbopack dev and production suites: `layout-segment-chunk-sharing`, `app-dir/dynamic`, `app-dir/dynamic-import`, `404-page-router`, `next-dynamic`, `pages-app-next-dynamic-preload`. - All 458 Rust snapshot/execution tests pass. Initial optimization renamed 45 outputs with identical mapped contents; the lazy fix introduces no additional snapshot changes. The identity-hash commit renames 15 more outputs; a mechanical check maps all 15 and finds identical contents apart from the changed names. - Core/ecmascript units: 813 passed, 2 skipped. Workspace fmt, check, clippy and docs pass with warnings denied. After the identity-hash change, lazy imports (19/19), lazy collision (1/1), and `app-dir/dynamic` production (12/12) pass with a rebuilt native binary. ### Out of scope - Lowering entry groups into chunking edges or narrowing them to subsets. - Canonicalizing proxy loaders themselves or resolving their manifests by activation key on the server. <!-- NEXT_JS_LLM_PR --> <!-- fleet 4f67c6f7-bbe2-454b-9a17-822a60ef8f7e --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
-
- 28 Oct, 2026 13 commits
-
-
next-js-bot[bot] authored
-
Andrew Clark authored
Adds the criteria Vercel Agent will use to review Next.js team PRs, and to decide whether to approve them or escalate to an area owner. Automated approvals will only run for members of the Vercel GitHub org who are also on an allowlist of core Next.js contributors. REVIEW.md is the main entry point for the agent. (A suggestion to the human reviewing this review procedure: imagine you're an agent and open that file.) It describes the protocol, then routes the agent to the appropriate tools and documents needed to conduct its review. I asked an agent to analyze the codebase and split it into areas with different owners. Each area can have its own review criteria. The initial set of areas and owners is just a starting point. Please submit changes, I know some of them will be wrong! The area-specific review criteria are also mostly empty. I seeded the agent with a starting set of "core" criteria. These are also not set in stone. I collected them from our existing skills and my own institutional knowledge of our team's practices. Please submit changes if you disagree with any, or want to propose more. **It's expected that the initial version of the review procedure will need significant tuning.** I ran some lightweight evals on historical PRs to check its effectiveness. We will continue to do this on a regular basis. The goal is for 90%+ of code reviews to result in the correct signal. **A human is still required for merge.** We are going from 2 humans in the loop to 1. Not 0. The quality of a PR is ultimately the responsibility of its merger and author. Be extra rigorous and vigilant as we iterate on this new review procedure. Refer to REVIEW.md for full details. --------- Co-authored-by:Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
-
Andrew Clark authored
Adds an experimental config flag, `experimental.hydrationChangeEvent`, that opts the `app` directory into React's experimental release channel (`react@experimental`) — the same channel already selected by `taint`, `transitionIndicator`, `gestureTransition`, and `blockingSSR`. The experimental React build ships React's internal `enableHydrationChangeEvent` feature flag, which isn't in React's canary channel yet. This flag lets teams try it ahead of that. It has no effect of its own beyond selecting the experimental React build. The flag is wired through `needsExperimentalReact` on the Next.js side and the matching `use_react_experimental` switch in Turbopack, so both bundlers pick the experimental build. <!-- NEXT_JS_LLM -->
-
Benjamin Woodruff authored
Turbopack: Move reference to bincode's virtue dependency into a vercel-labs owned fork repository (#100847) This is a perma-fork now that it appears there's zero chance upstream will come back. Let's move it out of a personally-owned repo (not a security issue, because the commit hash was pinned by the lockfile).
-
Aurora Scharff authored
### What? - Exclude intentional one-time `SecurityFatalError` and `UpgradeNudgeError` upgrade stops from the private Agent Feedback reporting protocol. - Keep retries that remain blocked, or documented remediation that fails, eligible as unexpected behavior. - Add an Agent Feedback eval with one genuine documentation mismatch and one expected upgrade stop. It requires the documentation report and rejects any report for the expected stop. - Add focused coverage for the internal protocol loader. ### Why? The Next.js upgrade gate intentionally stops a successful command once, explains that an upgrade is recommended, and allows the next run to continue. Agents were treating that expected stop as a Next.js error and filing duplicate feedback. The private reporting protocol should distinguish the expected gate from an actual failure of the retry or remediation path. This does not change the public generated `AGENTS.md` instructions. ### Verification | Check | Result | | --- | --- | | Agent Feedback CLI and protocol tests | 25 passed | | Eval fixture/config validation | Passed | | Prettier | Passed | | Agent eval model run | Attempted twice with the rebuilt local package; both shared AI Gateway requests failed before model execution |
-
Tobias Koppers authored
### What? Fixes the `bench/nested-deps-app-router-many-pages` harness so `node bench.mjs build` builds and reports this app, and the build logs no config warnings. ### Why? - The build step ran `next build ./bench/nested-deps-app-router`, a different bench app, but read `.next/trace` from this app's directory. The reported build duration didn't come from this app, and the run failed when the other app's components weren't generated. - `.next` was removed relative to the current working directory instead of this app's directory. Running the script from anywhere else skipped the cleanup. - `next.config.js` set `eslint.ignoreDuringBuilds`, which Next.js 16 rejects with the warning `Unrecognized key(s) in object: 'eslint'`. - The scripts set `NEXT_PRIVATE_LOCAL_WEBPACK=1`. That variable only makes Next.js resolve a project-local `webpack` package; it doesn't select webpack. Builds already use Turbopack by default, so the scripts looked like they benchmarked webpack when they didn't. ### How? - The build step now targets this app, and both `.next` cleanups resolve against the app directory, so the build and the trace it reads come from the same place. - Removed the unsupported `eslint` config. The `--cpu-prof` workaround stays. - Dropped the env var so every script uses the default bundler (Turbopack). This matches `bench-warm-build.mjs`, which already benchmarks Turbopack. `cross-env` is no longer used, so it's removed from the package and the lockfile. The sibling `bench/nested-deps` and `bench/nested-deps-app-router` apps have the same stale env var, and the latter also has the `eslint` key. They're left for a separate change. ### Verification - After `pnpm prepare-bench`, `node bench.mjs build` ran all three test cases. Each was a Turbopack build of this app's 3002 pages, the duration was read from the app's own `.next/trace`, and no config warnings were logged. - Before the change, the same command built `bench/nested-deps-app-router` and logged the `eslint` warning. - Not run: the dev/HMR and CPU-profiling modes. <!-- NEXT_JS_LLM --> <!-- fleet fade2a6c-31b0-41a3-bc95-33dd0ae47b2a --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Aurora Scharff authored
## Summary Agent Feedback currently records the coding harness but not the model that produced a report. In a recent sample, 61 of 108 reports named only a harness such as Claude Code, opencode, or Codex. That prevents us from comparing production friction with eval results by model, harness version, or reasoning effort. This updates the Agent Feedback protocol to schema version 6 and asks reporting agents to include structured: - harness version - model identifier - reasoning effort Agents use `unknown` when their environment does not expose a value instead of inferring it. Existing schema v4 and v5 report links remain valid. ## Companion changes - https://github.com/vercel-labs/next-maintainer-agent/pull/635 accepts and stores v6 metadata while retaining v4 and v5 compatibility. This is merged. - https://github.com/vercel/front/pull/94097 updates the nextjs.org review UI to parse v6 reports and show the harness, harness version, model, and reasoning effort under **Attached to this report**. The receiver must support v6 before this protocol change lands. The Front change makes the added metadata visible during report review but does not block receipt of v6 reports. ## Verification - `pnpm exec jest --runInBand --runTestsByPath packages/next/src/cli/internal/agent-feedback-instructions.test.ts` - `pnpm --filter=next build` <!-- NEXT_JS_LLM -->
-
Niklas Mischkulnig authored
It was doing something like this: ```js "use server"; export const foo = async function bar() { return 'exported named function expression'; }; ensureServerEntryExports([ bar, // should be foo! ]); registerServerReference(bar, "003c8ed39a99caf636869d076cc7cae786a4053164", null); // shoudl be foo! ``` leading to ``` ⨯ ReferenceError: quux is not defined at module evaluation (test/development/app-dir/source-mapping/app/actions1.ts:15:35) at module evaluation (test/development/app-dir/source-mapping/app/page.tsx:2:1) 13 | } 14 | > 15 | export const qux = async function quux() { | ^ 16 | return 'exported named function expression' 17 | } 18 | { page: '/' } ``` -
Niklas Mischkulnig authored
`jsonwebtoken` still uses `SlowBuffer` and is thus incompatible with Node.js 26 (`SlowBuffer` was removed): https://github.com/auth0/node-jsonwebtoken/issues/992 Use https://npmx.dev/package/fast-jwt instead of https://npmx.dev/package/jsonwebtoken. https://npmx.dev/package/jose is ~~way bigger~~ only has async APIs
-
Tobias Koppers authored
Follow-up to #100620, addressing [this review comment](https://github.com/vercel/next.js/pull/100620#discussion_r4399047345). ### What? `MetaFile::batch_lookup_entry` now finds the cells inside an SST file's hash range with `partition_point` instead of `binary_search_by`. ### Why? The old code used `binary_search_by` with a comparator that never returns `Equal` (`.then(Ordering::Greater)` / `.then(Ordering::Less)`) and then took the insertion point with `.err().unwrap()`. `partition_point` states the bounds directly and is easier to read. ### How? - Start: `cells.partition_point(|&(hash, _)| hash < range.min_hash)`, the first cell with `hash >= min_hash`. - End: `cells.partition_point(|&(hash, _)| hash <= range.max_hash)`, the first cell with `hash > max_hash`. Both return the same indices as before for every input, including duplicate hashes, empty slices, and bounds at `0` or `u64::MAX`. The now unused `Ordering` import is removed. There is no behavior change. <!-- NEXT_JS_LLM --> <!-- fleet 2e9e7c99-0cc2-4e7b-9e62-627c0627638b --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
-
Tobias Koppers authored
### What? Drop the non-adapter builder + cache components combination from the "Test new and changed tests when deployed" PR matrix. The matrix had 20 entries (group × builder × cache components); it now has 15: - adapter, cache components off - adapter, cache components on - non-adapter, cache components off ### Why? #100591 added the full builder × cache-components product. The release deploy tests never run cache components with the non-adapter Turbopack builder, so PR CI was testing a combination that release testing doesn't cover. ### How? The job gets a matrix `exclude` entry with a comment explaining why. The remaining 15 entries keep their names, `stepName`s, env and commands, so their report history continues. Nothing else in the workflow changes. Verified by parsing the workflow and expanding the matrix with GitHub's exclude rules. Every remaining rendered script was run with `node` stubbed, and each one matches canary's env and command. The `exclude` entry is the only difference from canary. <!-- NEXT_JS_LLM --> <!-- fleet 115592cd-38e9-4ec3-904b-f1c778e1e1d9 --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Tobias Koppers authored
### What? Makes rustdoc warnings fail CI for the whole Rust workspace, including private items, and fixes every existing warning so the new check starts green. - New `scripts/check-rustdoc.sh` runs `RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items`. - The existing `rustdoc check` job in `build_and_test.yml` now runs that script before `scripts/deploy-turbopack-docs.sh`. The public `next-*` docs build is unchanged. - Fixes the warnings across the workspace's Rust crates (turbo-tasks, turbo-tasks-backend, turbo-persistence, turbopack-*, next-core, next-api, next-napi-bindings, …). ### Why? The existing `rustdoc check` job only documented the public items of five `next-*` crates and didn't treat warnings as errors. Broken intra-doc links and other rustdoc warnings went unnoticed everywhere else. Running strict private-items docs over the whole workspace found about 60 of them. ### How? The Rust source changes are doc comments only. The only other doc edit is one link target in `singleton_pattern.md`. Nothing is silenced with `#[allow]`, and no imports or visibility changes were added for docs. Types of fix: - **Unresolved links**: point to the correct full path (`turbo_tasks::…`, `crate::…`, `Self::…`). Some links named renamed or moved items, for example `Effect::apply` → `CapturedEffect::apply` and `dec_in_flight` → `decrement_in_flight`. Those now point to the current item. - **Links to items rustdoc can't link to**: plain code text. These are test-only or feature-gated items, `doc(hidden)` items, private items in another crate, and a private trait rustdoc doesn't resolve. - **Ambiguous `crate::value`** (module and macro): `macro@crate::value`. - **Bare URLs**: wrapped in `<…>`. - **Unclosed HTML tags** from generics such as `Option<T>`: put in backticks. - **Redundant explicit link targets**: removed. The check runs with the workspace's default features on the CI target. It doesn't cover every feature or platform combination. ### Verification - `./scripts/check-rustdoc.sh && ./scripts/deploy-turbopack-docs.sh` (the exact CI step) passes locally. - `RUSTDOCFLAGS='-D warnings' cargo doc --workspace --no-deps` (public items) passes. - Negative check: a temporary broken intra-doc link made `scripts/check-rustdoc.sh` exit non-zero. - `cargo fmt --all --check` is clean. <!-- NEXT_JS_LLM --> <!-- fleet 4bbc2447-5ae3-4b88-9649-a6b5ff30491e --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by:
Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
-
Jiwon Choi authored
> [!TIP] > Best reviewed by hide whitespace: [files?w=1](https://github.com/vercel/next.js/pull/100733/files?w=1). Previously, were checking to close issue 1 per hour. Now that check closes all availables at once. Currently maxed to 5 from agent side.
-