- 23 Oct, 2026 18 commits
-
-
next-js-bot[bot] authored
-
Jamiboy Mohammad authored
## Summary Enables five suites in deploy mode whose builds are expected to fail, or whose setup used `patchFile` or a runtime-only env. - **`use-cache-unknown-cache-kind`, `use-cache-without-experimental-flag`, `proxy-and-middleware-conflict`**: outside dev the tests assert `next.start()` rejects and read the build diagnostics from `next.cliOutput`, with `toContain` checks in deploy mode and the existing snapshots locally. The first two previously branched on `isNextStart`, so in deploy mode their dev-only `createSandbox` tests ran instead. `proxy-and-middleware-conflict` drops its blanket `skipDeployment`. - **`cache-components-segment-configs`**: same `next.start()` rejection pattern. The layout-propagation test used `next.patchFile('app/layout.tsx', …)`, which deploy mode doesn't support. It now has its own `nextTestSetup` whose `overrideFiles` swaps in `fixtures/layout-runtime/app/layout.tsx`. The Turbopack location assertion moves from `./app/layout.tsx:2:24` to `:1:14` to match the fixture file. - **`cache-components-errors/console-patch`**: with the gate removed in the Sept 9 retry runs, the deployment failed because `NODE_OPTIONS='--require ./patch-console.js'` is forwarded as both a build and a runtime env, and Vercel's own CLI process crashed with `Cannot find module './patch-console.js'`. In deploy mode the preload is now scoped to the build via `buildCommand`; dev and start keep `env`. The deploy branch asserts the deployment succeeds (so the build didn't fail on the patched `console.log`) and that the patched log line appears in the build output. The local snapshots are unchanged. ## Verification - Prettier and ESLint on the changed files. - Ran all five suites locally against this branch's local packages; every suite passed in each of: - `next dev` and `next start`, with Turbopack and with webpack - deploy, Turbopack + adapter (the PR deploy job's variant) - deploy, Webpack legacy (one of the release workflow's variants) - Not run: Turbopack legacy deploy (`NEXT_ENABLE_ADAPTER=0`); my account lacks deploy access to the Turbopack test team's project. <!-- NEXT_JS_LLM --> -
Jamiboy Mohammad authored
## Summary Removes the deploy exclusion from eight suites and one describe block that pass against real Vercel deployments: - `app-dir/next-font`: also drops its `@next/font: 'workspace:*'` dependency. Nothing has resolved `@next/font` since #65601 and the fixture only imports `next/font/local`, but the package is private, so CI deploy jobs failed with a 404 installing it from the preview tarballs. - `app-dir/self-importing-package` - `i18n-data-fetching-redirect/redirect` - `relay-graphql-swc-multi-project` (both `project-a` and `project-b`; the existing `isNextDeploy ? it.skip` on the generated-types check stays) - `ssg-dynamic-routes-404-page` - `switchable-runtime` - `trailingslash-with-rewrite` - `transpile-packages`: drops both in-file deploy early returns, including a stale one about React 17 - `next-image-legacy/default` Static Image Component Tests: a leftover gate that only preserved the sibling Build Error describe's old `skipDeployment` focus. It passed 7/7 in the deploy job of [run 36052929022](https://github.com/vercel/next.js/actions/runs/36052929022) (#99187, Sept 24); the sibling's own gate now also skips its hooks (#98169). Not re-run locally. Four of these (`next-font`, `self-importing-package`, `relay-graphql-swc-multi-project`, `ssg-dynamic-routes-404-page`) previously failed to deploy on npm install errors (`ERESOLVE` on the React canary peer, the `@next/font` tarball, the local `.tar` dependency), which #99192 fixed. The others had never run in a deploy job. ## Verification Ran locally with `NEXT_TEST_MODE=deploy` against this commit's local packages, with the same env as the "Test new and changed tests when deployed" jobs: - Turbopack + adapter: all eight passed (54–112s each). - Turbopack + adapter + Cache Components: the six selected by the Cache Components manifest passed (`next-font` and `switchable-runtime` are excluded there). - Webpack, legacy (non-adapter) deploy, as in the release workflow: all eight passed. - Not run: Turbopack legacy deploy (`NEXT_ENABLE_ADAPTER=0`); my account lacks deploy access to the Turbopack test team's project. <!-- NEXT_JS_LLM -->
-
Tobias Koppers authored
## Summary Fixes the canary build. `turbopack-trace-utils` currently fails to compile (`rust check`, `rustdoc`, cargo unit/bench tests, wasi and every native build are red since #99809). #99809 (typed, delta-encoded trace timestamps) landed after two PRs it was never built together with: - **#99527** added `memory_footprint` to `TraceRow::MemorySample`. The new `TraceRow::try_map_timestamp` from #99809 rebuilds each variant field by field and doesn't copy it (`E0027`/`E0063` in `tracing.rs`). It now copies the field, and a new test checks that a `MemorySample` keeps all its fields through timestamp encoding, serialization and decoding. - **#100205** added trace-server test helpers for the untyped format. Their rows now have the wrong timestamp type, and a second `encode` writes rows without a `TimestampBase` (`E0428` plus 18 `E0308` in `reader/turbopack.rs` tests). The helpers now build `TraceRow<'_, u64>` rows and use the shared encoder. The partial-read test encodes one continuous trace and splits it before the last row, instead of encoding the last row on its own (that would now give it its own base). No assertions changed. The only production change is copying `memory_footprint`; the serialized format is unchanged. ## Verification - `cargo test` for `turbopack-trace-utils`, `turbopack-trace-server` and `turbopack-trace-size`, including all #100205 re-entry tests - `cargo clippy --all-targets -- -D warnings` for those crates; rustdoc with `-D warnings` <!-- NEXT_JS_LLM --> <!-- fleet 4a52842b-f1a2-43cb-9779-3655caada6a0 --> 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>
-
Sebastian "Sebbie" Silbermann authored
Follow-up to #100121. The gated release environments (`bot-approved`, `release-stable`, `release-beta`, `release-release-candidate`, `release-preview`) now list both Next.js Engineering and Turbopack as reviewer teams, so a member of either team can approve stable tag creation and non-canary publishes. Co-authored-by:Claude Code <noreply@anthropic.com>
-
Tobias Koppers authored
## Summary Bumps the trace file header from `TRACEv0` to `TRACEv1`, because the stack below changed the row format incompatibly. Readers only accept the current version and fail with a clear error on anything else. No v0 support is kept. - `TRACE_HEADER`, `TRACE_HEADER_PREFIX` and `check_trace_header` live in `turbopack-trace-utils` and are shared by the writer, the trace server and `turbo-trace-size`. - Trace server: format detection is now a small tested function. A `TRACEv*` file with another version fails with `Unsupported trace file version: expected TRACEv1, found TRACEv0`. That includes a file with only the 7-byte header. The fallback that read header-less files as Turbopack traces is gone, so unknown formats fail with an error. Next.js JSON traces and heaptrack files are still detected. Empty or partial-prefix files still wait for more data, because the server follows traces while they're written. - `turbo-trace-size` fails on missing or unsupported headers. - `next internal upload-trace` checks for `TRACEv1` and reports an unsupported version separately from a non-trace file. - `contributing/turbopack/tracing.md` documents the format and versioning. Stack (on top of #99765): 1. #99777: `no-memory` flag 2. #99778: Merge allocation counters into Enter/Exit rows 3. #99779: Delta-encode allocation counters, skip unchanged ones 4. #99780: Omit Exit+Enter pairs with (almost) no gap 5. #99808: zstd flags 6. #99809: Delta-encoded timestamps 7. #99781: **This PR**: bump the trace header to `TRACEv1` 8. #99810: `upload-trace` accepts compressed traces ## Measurements (whole stack) `next build` of `bench/heavy-npm-deps`, release native binding built from source: | | `1` raw | `1,zstd` | `turbo-tasks,zstd` | | --- | --- | --- | --- | | before (#99765) | 68.2 MiB | 21.4 MiB (zstd -3 offline) | | | after #99780 | 22.8 MiB | 5.9 MiB | 26.8 MiB | | after this stack | **20.1 MiB** | **4.5 MiB** | **21.1 MiB** | The `before` zstd number comes from compressing the raw trace offline; the writer couldn't write zstd before this stack. ## Verification - **Tests:** `check_trace_header`, server format detection (old, unknown, partial and header-only files), and `turbo-trace-size` rejecting missing or old headers. - **Captures:** traces from a locally built release binding (`1`, `1,zstd`, `turbo-tasks,zstd`) start with `TRACEv1`, and `turbo-trace-size` decodes them fully. - The trace server loads them completely: 39,481 and 817,619 spans. - Both tools reject a `TRACEv0` file with the error above. <!-- NEXT_JS_LLM --> <!-- fleet 4a52842b-f1a2-43cb-9779-3655caada6a0 --> 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
## Summary Delta-encodes all timestamps in Turbopack trace files. Absolute microsecond timestamps take 4–5 bytes as varints. The difference to the previous row of the same thread usually fits in 1–2 bytes. - **Format:** every row timestamp (`Start`, `End`, `Enter`, `Exit`, `Event`, `MemorySample`) is now the difference to the previous timestamp in the same thread local buffer. The serialized `ts` fields are `DeltaEncodedTimestamp`, an `i64` newtype that postcard zigzag-encodes, so a clock that goes backwards still works. `TraceRow` is generic over its timestamp type: `TraceRow<'a>` is the serialized form, and decoding returns `TraceRow<'a, u64>` with absolute timestamps, so the types show whether a row still needs decoding. - **New row:** `TimestampBase { ts }` carries an absolute timestamp. The writer puts one before the first row with a timestamp in every buffer. Buffers are flushed independently and interleave in the file, so each one can be decoded on its own. - **Large jumps:** a new base is also written when a difference doesn't fit in an `i64`. - **Writer:** the encoder state lives in the buffer and is reset when a buffer is sent, stolen by the writer thread or reused. Removing the last row (#99780) also removes its base and restores the encoder state. - **Readers:** the trace server, `turbo-trace-size` and the tests share `TimestampDecoder`, which keeps its state across incremental reads. A timestamp before any base is an error. `turbo-trace-size` reports the error with its offset. The header is bumped to `TRACEv1` in #99781, at the top of this format-changing stack. Stack (on top of #99765): 1. #99777: `no-memory` flag 2. #99778: Merge allocation counters into Enter/Exit rows 3. #99779: Delta-encode allocation counters, skip unchanged ones 4. #99780: Omit Exit+Enter pairs with (almost) no gap 5. #99808: zstd flags 6. #99809: **This PR**: delta-encoded timestamps 7. #99781: Bump the trace header to `TRACEv1` 8. #99810: `upload-trace` accepts compressed traces ## Measurements `next build` of `bench/heavy-npm-deps`, release bindings built from the previous PR and from this one. Medians of 3 rounds that alternate between the two builds: | mode | before | after | change | | --- | --- | --- | --- | | `1` | 23.94 MB | 21.03 MB | −12.2% | | `1,zstd` | 6.15 MB | 4.72 MB | **−23.2%** | | `turbo-tasks` | 155.97 MB | 145.28 MB | −6.9% | | `turbo-tasks,zstd` | 28.14 MB | 22.13 MB | **−21.4%** | - **Row sizes:** Enter, Exit and End rows get about 2.2 bytes smaller each. - **Overhead:** `TimestampBase` rows add 137 B (35 rows) to the `1` trace and 896 B (214 rows) to the `turbo-tasks` trace. ## Verification - **Tests:** - encoder and decoder round trips, including large jumps and incremental reads; - buffers that are sent, stolen or reused, and a buffer that starts with a `Record` (its base comes before the first row with a timestamp); - removing the first or last row of a buffer; - exact timestamps across 2 threads and many buffers. - **Captures:** the release-build captures are decoded fully by `turbo-trace-size` and load completely in the trace server, raw and zstd. Span counts per name match the previous PR. <!-- NEXT_JS_LLM --> <!-- fleet 4a52842b-f1a2-43cb-9779-3655caada6a0 --> --------- 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>
-
Niklas Mischkulnig authored
### What? Add agent instructions for developing with turbo_tasks across `crates/` and `turbopack/`. ### Why? Preserve fine-grained caching and invalidation by guiding cell creation, task inputs, task boundaries, and access to build-wide maps. Discourage unnecessary interning tasks and copying existing cell usage without checking its assumptions. ### How? Keep the generic turbo_tasks guidance in `turbopack/AGENTS.md` and reference that section from `crates/AGENTS.md`. This preserves the dependency direction from Next.js-specific crates to Turbopack, avoids duplicating the rules, and leaves the root instructions and existing Turbopack-specific boundaries unchanged. ### Verification - Checked the shared-guide link resolves and the root instructions are unchanged. - Reviewed the guidance against existing turbo_tasks APIs. - Formatting checked manually; Prettier is unavailable in the checkout. No runtime tests were run for this instructions-only change. <!-- NEXT_JS_LLM --> <!-- fleet 0c8ecb28-308d-4b94-b67e-439012814b85 --> --------- 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? `pnpm new-test` with the `unit` type now generates a flat `test/unit/<name>.test.ts` from a template, and nothing else. ### Why? The `test` generator copied from `test/unit/test-template`, which didn't exist. As a result, `pnpm new-test --args false my-unit unit` created no test file at all, only `test/unit/my-unit/tsconfig.json` and `next-env.d.ts`. That layout also doesn't match how unit tests are organized: they are flat files in `test/unit/`. Since `AGENTS.md` requires generating tests with `pnpm new-test`, the unit type needs to work. ### How? - Added a unit template, `test/unit/test-template/template.ts`. It's a minimal Jest test that passes as generated, with a pointer on how to import the code under test. A single `add` action renders it to `test/unit/{{ toFileName name }}.test.ts`. - Unlike the e2e templates, the file is deliberately not named `*.test.ts` and has no spaces in its path. Otherwise the unit runner would collect the template as a test, and on Windows `run-tests.js` spawns jest through a shell that splits the Handlebars filename at its spaces. That makes the `test unit windows` job pick up unrelated e2e suites and fail. - The generator treats unit tests as a separate case: - `appDir` is ignored, so output never goes into `test/unit/app-dir/`. - The `tsconfig.json`/`next-env.d.ts` steps are skipped, since those only make sense for Next.js app fixtures. - The e2e, production and development generation is unchanged. - Documented the unit invocation in `AGENTS.md`. ### Verification - `pnpm new-test --args false my-unit unit` and `pnpm new-test --args true my-unit unit` both create only `test/unit/my-unit.test.ts`, and `pnpm jest test/unit/my-unit.test.ts` passes. - `node run-tests.js --type unit --dry` and `pnpm jest --listTests test/unit/test-template` no longer pick up the template. - `pnpm new-test --args true my-e2e e2e` and `pnpm new-test --args false my-prod production` still generate their fixtures, test file, `tsconfig.json` and `next-env.d.ts`. <!-- NEXT_JS_LLM --> <!-- fleet 813069b1-faf3-4c96-bd75-2be047fed0b3 --> --------- 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>
-
Hendrik Liebau authored
A cache handler lookup for a `'use cache'` function started for one route can be shared with another route that has different implicit tags. The reproductions show that the route passed to `revalidatePath()` can still receive the old value instead of regenerating it. Another case shows that a route can bypass its cache handler while a fill is pending. Shared invocation results also preserve the first caller's rendering decision. A direct prerender caller can leave a nested cache waiting on a hanging promise, and one prerender can pass its hanging promise to another. Direct and nested callers can also inherit the wrong revalidation decision for a stale entry. These tests deliberately assert the current incorrect behavior. #100511 corrects the assertions alongside the wrapper rewrite.
-
Hendrik Liebau authored
The existing handler-error tests cover error reporting and rendering after a failed write. The new tests also cover intra-request lookup retries and a joiner that needs a different root key after the producer's write fails. A held write verifies that the retried calls can consume the same generated value before persistence finishes. The root-param case verifies that the joiner persists and reuses its own value. Both cases pass before the wrapper rewrite in #100511.
-
Jan Kassens authored
# Jan's notes After this, there's only one place left that writes `stagedFallbackParams` to the request params object, but that appears to be in the adapter boundary and I'm not sure that would be a breaking change. # AI ## Summary Pass staged fallback params explicitly to each `doRender` invocation, removing the handler's request-metadata writes and rereads. Each render now owns its staging selection, including debug shells, background shell upgrades, and resumes. Retain the dev metadata handoff from `base-server`, captured once at the adapter boundary. Preserve placeholder map identity and the precedence of masks recorded in postponed state. ## Verification - `pnpm test-dev-turbo` and `pnpm test-start-turbo`: instant-navigation-testing-api, instant-validation-static-shells (both variants), fallback-shells, and ppr-root-param-fallback. - `pnpm test-start-turbo`: partial-fallback-shell-upgrade and partial-fallback-root-blocking. - `pnpm test-dev-webpack` and `pnpm test-start-webpack`: instant-navigation-testing-api. - Postponed-state and fallback-params unit tests. - 262 tests passed across 16 suites; 12 existing skips. <!-- NEXT_JS_LLM -->
-
Jiachi Liu authored
Links from `global-not-found` to app routes can leave users stuck on the 404 page because the router does not recognize that leaving the global 404 changes the root layout. Treat navigation away from `global-not-found` as a root layout change and perform a full-page navigation. Add an e2e regression test covering a link back to the home page. <!-- NEXT_JS_LLM -->
-
digasic authored
### What? End the `CacheSignal` read in `encryptActionBoundArgs` on the Resume Data Cache hit path, so a request's `cacheReady()` can resolve. ### Why? `encryptActionBoundArgs` calls `startReadOnce()` before looking the serialized bound args up in the RDC. On a hit it returns the cached ciphertext immediately and never calls `endReadIfStarted()`, leaving the request's `CacheSignal` count at 1 forever. With `partialPrefetching` the dynamic render embeds a runtime-prefetch stream in the initial RSC payload and only writes/closes it after `cacheSignal.cacheReady()` (`startRuntimePrefetchRender`). With the read never ended, that stream is never closed, the Flight stream never ends, the HTML `</body></html>` suffix is never flushed, and the HTTP response of every partially prerendered page that renders an inline Server Function with bound args never terminates in production (`next start`). curl waits for its timeout; browsers stay in `document.readyState === "loading"`. The hit is the normal production case: the build-time prerender stores the encrypted bound args in the RDC, which is persisted in the postponed state whenever the page has at least one `"use cache"` entry. ### How? Call `endReadIfStarted()` before returning `cachedEncrypted`, mirroring the miss path (which ends the read after `encodeActionBoundArg`) and the error path. Adds an e2e test (`test/e2e/app-dir/partial-prefetching-inline-server-function`) with `cacheComponents` + `partialPrefetching`, a page that has a `"use cache"` entry, an inline Server Function closing over a prop and a `cookies()` hole; it asserts that a production fetch of the page completes and the body ends with `</html>`. Without the fix, reading the body never resolves. Fixes #100621
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by:Claude Fable 5.1 <noreply@anthropic.com>
-
Tobias Koppers authored
### What? Ignores four timing-sensitive `turbo-tasks-fs` watcher tests in GitHub Actions while keeping them enabled for local runs: - `irrelevant_events_do_not_delay_invalidation` - `repeated_writes_to_tracked_file_are_debounced` - `recreated_directory_is_watched_again` - `read_registered_before_watch_is_restored_is_invalidated` ### Why? These watcher tests depend on filesystem-event and debounce timing, which is unreliable on CI runners and causes flaky failures. ### How? - `turbo-tasks-fs` gets an opt-in `ci` cargo feature. Each of the four tests is ignored only when that feature is enabled. The attribute is placed after the rstest cases so it applies to every generated case (14 in total). - A dedicated `test-cargo-unit-ci` script and Turbo task enable `turbo-tasks-fs/ci` for the nextest and doctest commands. A separate script is needed because extra Turbo args are appended only to the final command in the existing `&&` chain. - The `test-cargo-unit` GitHub Actions job now runs `test-cargo-unit-ci`. The existing local `test-cargo-unit` command is unchanged and still runs these tests. ### Verification - `cargo test -p turbo-tasks-fs --lib --features turbo-tasks-fs/ci -- watcher::tests`: 6 passed, 14 ignored - `cargo test -p turbo-tasks-fs --lib -- watcher::tests`: 20 passed, 0 ignored - Compared `cargo nextest list` JSON output with and without the feature: exactly the 14 targeted cases change ignore status. - Turbo dry run resolves `@next/swc#test-cargo-unit-ci` to the feature-enabled commands. <!-- NEXT_JS_LLM --> <!-- fleet 3dc2faec-b6b1-43eb-ae2d-4951789fb457 --> 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
-
Niklas Mischkulnig authored
This reverts https://github.com/vercel/next.js/pull/99549 and #100597 See https://github.com/vercel/next.js/pull/100635 for the regressions
-
Will Binns-Smith authored
## Summary Analyze each emitted and traced file once in a cached task that returns its filename, chunk membership, and chunk parts with normalized sources and compressed sizes. Routes previously made 3–5 task calls per shared file, and task-graph bookkeeping for those calls dominated analysis. Splitting, compression, and membership enumeration run as plain helpers under that task, since each is read once. Measured on v0/chat with `next build --analyze` (#99962), analysis phase only: new tasks went from 269k to 242k, calls into existing tasks from 8.49M to 5.07M, and median CPU time from 150s to 124s. All 455 data artifacts were byte-identical across 12 runs. Supersedes #100486. ## Verification - `cargo test -p turbopack-analyze --test split_chunk` and `cargo test -p next-api --lib analyze` passed. - Rebuilt the native binding with `release-with-debug`, installed it in v0/chat, and compared `next build --analyze` output against the previous binary across alternating runs. <!-- NEXT_JS_LLM -->
-
- 22 Oct, 2026 22 commits
-
-
next-js-bot[bot] authored
-
Niklas Mischkulnig authored
## Summary Preserve effects from evaluating a constructor callee even when construction is PURE-annotated. For example, `/*#__PURE__*/ new (getConstructor())()` must account for calling `getConstructor()`. Visit the callee before arguments, matching pure call handling. Add analyzer and execution regressions while preserving upstream PURE callback handling from #100577. Independent of the callback stack (#100586 / #100587); rebase whichever lands later if their `Expr::New` edits overlap. ## Verification - Full `turbopack-ecmascript` library: 609 tests passed. - Constructor-callee execution regression passed. - Rustfmt and diff checks passed. Full monorepo suite not run locally. <!-- NEXT_JS_LLM --> <!-- fleet 87a54898-52c9-4506-ae11-7f75f7e661f6 --> Co-authored-by:vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
-
Jimmy Miller authored
Okay, so for these hashes the way it works in webpack is they have an assembly script implementation that they then go and compile to wasm and embed that wasma as a base64 encoded string. I felt introducing wasm was a bit overkill. My first thought was doing this with rust. But even giving it the best possible chance of winning (using workers vs processes) it doesn't win on these smaller cases. It does on the larger ones. Judging all of this, I thought the easiest answer is to just do some iterations with an agent on making these as fast as I could in js. Agents are quite good at algorithms like this. I did do some random testing of a ton of inputs and everything matches up. The speed reults are still a mixed bag. | Workload | JS | WASM | Integrated Rust | Rust vs JS | JS vs WASM | | ------------------------------ | -------: | -------: | --------------: | ----------- | ----------- | | CSS MD4, 100 classes ×2 | 57 µs | 50 µs | 398 µs | 7.0× slower | 1.1× slower | | CSS xxhash64, 100 classes ×2 | 86 µs | 48 µs | 439 µs | 5.1× slower | 1.8× slower | | CSS MD4, 1,000 classes ×2 | 584 µs | 516 µs | 3,572 µs | 6.1× slower | 1.1× slower | | CSS xxhash64, 1,000 classes ×2 | 792 µs | 459 µs | 2,445 µs | 3.1× slower | 1.7× slower | | Babel MD4, 64 KiB | 108 µs | 70 µs | 65 µs | 1.7× faster | 1.5× slower | | Babel MD4, 1 MiB | 1,582 µs | 1,090 µs | 974 µs | 1.6× faster | 1.5× slower | | Babel xxhash64, 64 KiB | 41 µs | 4.4 µs | 19 µs | 2.2× faster | 9.3× slower | | Babel xxhash64, 1 MiB | 642 µs | 68 µs | 249 µs | 2.6× faster | 9.4× slower | Wasm is the winner. But I just wasn't sure it was really by enough to go add that complexity. The js keeps this as simple as we can get. Considering this hasn't been implemented earlier, I doubt this is super crucial, but we can always revisit if needed. Here are two uses of this functionality as described by the clanker > CSS Modules (css-loader): hashes the file path and local class name to generate scoped class names. This means many tiny hashes—roughly one per selector occurrence, sometimes more for longer generated names. It does not hash the whole stylesheet. > Babel (babel-loader): with disk caching enabled, hashes the source, options, and cache identifier to choose a cache filename. Usually one source-sized hash per file; no hashing when disk caching is disabled. I am adding this for completeness. But I think many uses of it (css modules for example) are going to be things we recommend native replacements for. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors We encourage you to use AI to assist you in researching, creating, and reviewing changes. However, you must review and deeply understand the contributions you are making. For this reason, **pull request descriptions from external contributors must be written by a human**. ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Signed commits - This repository requires verified commit signatures on protected branches. - If this pull request is blocked for unsigned commits, re-sign the commits and force-push the branch. - A `Signed-off-by` line in the commit message is not enough. ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # -->
-
Sebastian "Sebbie" Silbermann authored
No known real UA string we're aware of exceeds ~500 bytes (uap-core: longest 492 B across 30,873 distinct strings; Matomo DeviceDetector: longest 482 B across 40,348), so oversized UAs are never bots we need to identify. This bounds regex work on attacker-controlled input as DoS defense-in-depth, mainly for user-configured `htmlLimitedBots` patterns which may be more expensive than the built-in one. A >1KB UA containing a bot token (e.g. `WhatsApp`) is now treated as a non-bot (streaming metadata served, `isBot()` false). Hosting providers likely already cap the `User-Agent` header (or any header value) e.g. [Vercel caps at 16kb](https://vercel.com/docs/errors/request_header_too_large) <!-- NEXT_JS_LLM --> --------- Co-authored-by:
Claude Code <noreply@anthropic.com>
-
Sebastian "Sebbie" Silbermann authored
The agent instructions required a full `pnpm build-all` (JS and Rust) after every worktree creation or branch switch. That is unnecessary when bootstrapping a new clone or worktree: `pnpm install` already pulls in recent published native bindings, so there is nothing to build until source changes. The new guidance: - Bootstrapping a new clone or worktree does not start with `pnpm build-all`. Build only what your work changes: `pnpm --filter=next build` for core-only JS edits, `pnpm build` when JS changes span packages. - Switching branches or pulling can still require a build when it moves JS or Rust source relative to your build outputs; rebuild the affected parts before running tests. - `pnpm build-all` is reserved for Rust/Turbopack changes, or for when Next.js fails to start because native binding changes landed on canary after the last npm publish (cross-referenced from the Stale Native Binary section). The `backport-pr` skill repeated the old branch-switch rule and is updated to the same policy. <!-- NEXT_JS_LLM --> Co-authored-by:Claude Code <noreply@anthropic.com>
-
Jan Kassens authored
## Summary Fix the `no-map-async-cell` violation in webpack loader build-dependency tracking so `ast-grep scan --format github` passes again. Prepare resolver options concurrently, then create their cells synchronously in request order before resolving modules concurrently. This prevents async completion order from determining Turbo Tasks cell order. CI context: bc37b30d (#100569) aligned the CI ast-grep version with the repository (0.31.0 → 0.42.0), restoring enforcement of lint failures. #100562 fixed the analyzer occurrence, but #99549 subsequently introduced this occurrence in `build_module_requests_changed`. Tradeoff: the two phases add an intermediate vector allocation and a synchronization barrier: all options must be prepared before any module resolution starts. This may reduce overlap; the performance impact has not been measured. There may be a better approach, such as reading the shared resolver options once and synchronously cloning/customizing them before creating cells, avoiding the extra preparation join. ## Verification - `pnpm exec ast-grep scan --format github` - `ast-grep test` (7 passed) - `cargo fmt --all -- --check` - `cargo check -p turbopack-node --offline` - `pnpm build-all` <!-- NEXT_JS_LLM -->
-
Jan Kassens authored
## Summary Continue decoupling App Router rendering from HTTP responses by binding lazy development response capabilities at the route-module boundary. HMR cancellation, validation scheduling, and worker snapshots use these capabilities instead of accessing `originalResponse` in the renderer. Preserves listener registration timing, abort reasons, live completion state, and the response wrapper's preview-cookie synchronization. Adds unit coverage for these behaviors and scoped import restrictions to keep response lifecycle access at the adapter boundary. ## Verification 38 test executions passed: - Lifecycle and existing response-completion unit tests: 11. - `test-dev-turbo`: HMR cancellation, validation scheduling, and worker source maps: 11; 9 snapshots. - `__NEXT_CACHE_COMPONENTS=true test-dev-turbo`: HMR cancellation and static-shell validation: 8; 1 snapshot. - `test-dev-webpack`: HMR cancellation and validation scheduling: 6. - `test-start-webpack`: standalone Node/Edge bundling: 2. <!-- NEXT_JS_LLM -->
-
Jimmy Miller authored
Track transitive modules, resolution requests, and package directories.
-
Jan Kassens authored
## Summary Upgrade the interceptor vendored for experimental test mode from `0.42.6` to `0.45.9` and regenerate its bundle. Leave the separate interceptor dependency pulled in by MSW unchanged. The old bundle can crash Node with `SIGSEGV` when an HTTPS keep-alive socket receives two mocked responses with `Content-Length`, then switches to real socket passthrough. The first fixed upstream release was `0.45.6` ([mswjs/interceptors#851](https://github.com/mswjs/interceptors/pull/851)); `0.45.9` also includes subsequent socket and HTTP fixes. The affected dependency entered Next.js in `16.3.0-canary.98` via #96059. ## Verification - Existing `test/e2e/testmode/testmode.test.ts`: all 16 tests passed in each of `test-dev-turbo`, `test-dev-webpack`, `test-start-turbo`, and `test-start-webpack`. - Local Next.js-level A/B reproduction using a route handler, test proxy, and loopback HTTPS server: two mocks followed by true passthrough using Next's internal request marker. Substituting the base revision's exact `0.42.6` bundle reproduced `SIGSEGV` on Node 24.14.0; the `0.45.9` bundle passed with the same socket reused. The upgraded fixture passed in all four modes above and on Node 24.14.0. This temporary fixture is not included in the PR. - Standalone checks passed on Node 20.20.2 and 24.14.0 for TLS keep-alive reuse, per-request authentication headers, response event counts, and abort recovery. <!-- NEXT_JS_LLM -->
-
Jimmy Miller authored
Enable development-only lazy imports for Node.js route handlers, Pages API routes, and Pages SSR while keeping startup entries eager.
-
Jan Kassens authored
## Summary Avoid initializing React when the router server and fetch helpers are imported. Load React when constructing the fetch deduplication helper, and share the fetch-patched symbol through a standalone module so the router server can access it without loading the fetch patcher. Removed the lazy module evaluation unit test following review feedback. ## Verification - Previously validated fetch deduplication and fetch patching unit tests, plus `test/e2e/app-dir/app-fetch-deduping/app-fetch-deduping.test.ts` in development with Turbopack and production with webpack. - Rebased onto `canary` (`3f51f6e6`); confirmed the implementation patches are unchanged. Tests were not rerun for the test deletion. <!-- NEXT_JS_LLM -->
-
Jamiboy Mohammad authored
## Summary Removes the `TODO(deploy-test-completion)` exclusion from two suites that already pass against a Vercel deployment: - `test/e2e/app-dir/log-file/log-file.test.ts` — passed in 6 deploy jobs (normal and Cache Components, 55–75s each) when its gate was removed in the Sept 9 retry runs, e.g. [run 34404668278](https://github.com/vercel/next.js/actions/runs/34404668278) and [run 34404667354](https://github.com/vercel/next.js/actions/runs/34404667354). The browser-log assertions run for real; the `next-development.log` check in the non-dev branch only asserts the log file is absent, which also holds for a deployment. - `test/e2e/worker-react-refresh/worker-react-refresh.test.tsx` — passed in both deploy variants (~60s each) of [run 36052929022](https://github.com/vercel/next.js/actions/runs/36052929022) from #99187. Both files are unchanged since those runs apart from the gate itself and a dev-only snapshot line. Three other suites that looked green in the same runs are not included: `404-page-router`, `draft-mode`, and `app-dir/actions/app-action-export` each had an in-file `isNextDeploy`/`!isNextStart` early return at the time, so the deploy job only ran a placeholder test. ## Verification - Checked neither suite is listed in `test/deploy-tests-manifest.json`. - Not run locally in deploy mode (no `VERCEL_TEST_TOKEN` locally); this PR's deploy job covers it. <!-- NEXT_JS_LLM -->
-
Jamiboy Mohammad authored
## Summary `test_e2e_deploy_release.yml` can be dispatched with a custom deploy script to run the deploy suite against another platform's adapter. The webpack job still set `NEXT_TEST_DEPLOY_TARGET_VERCEL=1` in that case, so tests gated on the `vercel` condition from #99837 ran against the other platform instead of being skipped. The webpack job now sets it only when no custom deploy script is given, as the Turbopack job already does. The adapter job is unchanged: it doesn't accept custom scripts, so it always deploys to Vercel. ## Verification - The webpack and Turbopack jobs now use the same `NEXT_TEST_DEPLOY_TARGET_VERCEL` expression, and the workflow still parses. - Not run: a dispatched `test-e2e-deploy-release` run (`workflow_dispatch` only). <!-- NEXT_JS_LLM -->
-
Niklas Mischkulnig authored
## Summary Honor PURE annotations without treating function arguments as invoked when checking call and constructor side effects. Continue checking argument evaluation, while retaining conservative callback handling for unannotated known builtins. ## Verification - Not run: tests (split existing commits into a PR stack; no source changes). <!-- NEXT_JS_LLM -->
-
Jan Kassens authored
## Summary App Router server traces currently include the installed React package through shared framework modules. This separates render validation from dynamic tracking so server bootstrap imports cannot reach the validation code's React lookup. Validation keeps its direct `require('react')` inside renderer bundles, where bundler aliases select the appropriate React instance. The fetch patch marker also moves to a standalone module so reading it does not load the fetch implementation. The adapter minimal-server trace drops the installed React files and six validation-only framework files. This is an independent alternative to using the renderer React registry in #100466. These solutions are for comparison; only one should land. ## Performance Compared `bfe0ccd57f` against its immediate parent, `72895219`, in a small production `next start` benchmark on October 20, 2026. Both revisions used release builds, Turbopack-built applications, Node 24.21.0, and the same dependencies on an Apple M5 Pro. Cache Components and Partial Prefetching remained enabled. | Measurement | Base → branch | Change | | --- | --- | --- | | JavaScript files loaded through the first API/static response | 473 → 463 | 10 fewer files | | JavaScript files loaded through the first dynamic response | 476 → 466 | 10 fewer files | | Loaded file-backed JavaScript source | About 214 KiB less | About 4.8% reduction | | Median process start → complete API response | 171.36 → 168.79 ms | 1.50% faster | | Median process start → complete static response | 168.60 → 167.33 ms | 0.75% faster | | Median process start → complete dynamic response | 412.08 → 410.69 ms | 0.34% faster | Startup measurements used 30 paired fresh-process trials per route, alternating revision order, with TCP-only readiness and exactly one HTTP request. The branch completed sooner in 29/30 API pairs; the dynamic startup result was inconclusive. Separate instrumented captures reproduced the same loaded-file sets twice; source sizes describe files loaded by the server, not browser downloads or allocated memory. Warm throughput was essentially unchanged across five paired trials per route: API −0.53%, static −0.11%, dynamic 0%. Each trial used 3 seconds of warmup, 10 seconds of measurement, and 50 keep-alive connections. The dynamic fixture includes a 200 ms wait, which limits its sensitivity to rendering overhead. All load trials completed without errors, timeouts, or non-2xx responses, and both revisions passed API, static response, dynamic freshness, and streaming behavior checks. These local measurements used warm filesystem caches and shared-machine load generation. They show reduced eager dependency loading and a modest API startup benefit; they do not establish serverless cold-start gains or a material warm-throughput improvement. ## Verification - `pnpm test-start-turbo test/production/next-server-nft/next-server-nft.test.ts` — 6 tests and 5 snapshots passed. - `pnpm test-start-webpack test/e2e/app-dir/app/standalone.test.ts` — 2 tests passed, including Edge runtime bundling. - Existing Cache Components error coverage for RSC (Dynamic Root) and SSR (`useSearchParams`) passed with both Turbopack and webpack: 2 tests and 2 snapshots per bundler. - `pnpm test-dev-turbo test/e2e/app-dir/cache-components-errors/{client,sync-dynamic}.test.ts -t 'useSearchParams in Client Components|Dynamic Root'` - `pnpm test-dev-webpack test/e2e/app-dir/cache-components-errors/{client,sync-dynamic}.test.ts -t 'useSearchParams in Client Components|Dynamic Root'` <!-- NEXT_JS_LLM --> -
Tobias Koppers authored
### What? Adds snapshots for deployments built without the adapter to `test/e2e/app-dir/otel-middleware-trace/otel-middleware-trace.test.ts`. Test-only change. ### Why? The v16.5.0-canary.23 release deploy tests ([run 39773330104](https://github.com/vercel/next.js/actions/runs/39773330104)) fail 20 of 30 tests in this file, on every retry, in `Run Deploy Tests (Turbopack)` and `Run Deploy Tests (Webpack)`. Those jobs deploy with `NEXT_ENABLE_ADAPTER=0`. The deploy snapshots were filled from PR CI, which deploys only through the adapter (`NEXT_ENABLE_ADAPTER=1`). `Run Deploy Adapter Tests` passes the same file. Without the adapter, the trace topology is the same: one trace, and the middleware and render are siblings under `Next.request` or the incoming context. Only the render's spans have the self-hosted shape: - the request span is unnamed (`GET` instead of `GET /page/page`); - `findPageComponents` → `loadRouteModule` spans appear; - the render's `instrumentation.ts` lifecycle spans are startup roots. Node.js middleware still emits its lifecycle spans inside the middleware span. ### How? - **Builder flag.** A new `isNonAdapterDeploy` flag selects non-adapter snapshots for deployments without the adapter, in the default render mode. - The snapshots are the complete received trees from that run. They were identical across Turbopack and Webpack and all 3 attempts. - The lifecycle-span test reuses the existing self-hosted snapshot. - **Existing snapshots unchanged.** All adapter, self-hosted and Cache Components snapshots stay as they are. Non-adapter deployments with Cache Components keep the existing assertions, because the release suite doesn't run that combination, so there's no observed tree to assert. - **No coverage dropped.** No deployment skips or known-failure entries. Verification: - **Mechanical checks.** The new literals were checked against the trees reconstructed from the CI logs. A check of which snapshot each of the 192 test/environment combinations selects confirms that only default-mode non-adapter deployments change. - **Local runs.** `test-start-turbo`, `test-dev-turbo` and `test-start-webpack` pass with no snapshot changes. - **Not confirmed by PR CI.** PR CI deploys only through the adapter, so it doesn't exercise the new snapshots. The next release deploy run confirms them. <!-- NEXT_JS_LLM --> <!-- fleet ce0ecb23-b14c-4679-92a9-e676130f618e --> 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> Co-authored-by:
Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
-
next-js-bot[bot] authored
This auto-generated PR updates the development integration test manifest used when testing Rspack. Co-authored-by:next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
-
next-js-bot[bot] authored
This auto-generated PR updates the production integration test manifest used when testing Rspack. Co-authored-by:next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
-
Niklas Mischkulnig authored
The ast-grep versions got out of sync in https://github.com/vercel/next.js/pull/94150, causing lint failures to not fail CI. Depends on https://github.com/vercel/next.js/pull/100562 to make CI pass again
-
next-js-bot[bot] authored
-
Sebastian "Sebbie" Silbermann authored
Follow-up to #100121. `publishRelease` no longer mints an App token at all. Un-drafting the GitHub release must stay authenticated as the release App: events caused by `GITHUB_TOKEN` do not trigger workflow runs, and release-published automations depend on the event. Previously that meant the bot key had to be available to the `publishRelease` job. With this change a small `undraftRelease` job runs in `bot-autonomous` instead, after the gated publish succeeded (the tag is already trusted at that point), so the key never leaves the two `bot-*` environments. Backports: #100572 (`releases/lts/active`), #100573 (`releases/lts/maintenance`) — their publish scripts read `lerna.json`, so the script is adapted there. --------- Co-authored-by:Claude Code <noreply@anthropic.com>
-
zydo authored
## Summary Prepare each endpoint group asynchronously, then create its chunk-group and route-entry cells in endpoint order. This makes cell creation deterministic and satisfies the `no-map-async-cell` lint rule without changing the analyzer's output. ## Verification - `pnpm lint-ast-grep` - `pnpm build-all` - `cargo fmt --all -- --check` - `TMPDIR=/private/tmp pnpm test-start-turbo test/e2e/next-analyze/next-analyze.test.ts` (6 tests passed) <!-- NEXT_JS_LLM -->
-