1. 06 Mar, 2026 2 commits
    • nextjs-bot's avatar
      v16.2.0-canary.82 · d1fcd201
      nextjs-bot authored
      d1fcd201
    • Tobias Koppers's avatar
      Set DontFork and Unmergeable on all mmap sites in turbo-persistence (#90941) · 83ae8ad6
      Tobias Koppers authored
      ## Summary
      
      - Add `madvise(MADV_DONTFORK)` and `madvise(MADV_UNMERGEABLE)` to all mmap sites in turbo-persistence
      - Extract a shared `advise_mmap_for_persistence` helper into a dedicated `mmap_helper` module
      
      ## Why
      
      `read_blob` in `db.rs` already correctly sets `DontFork` and `Unmergeable` on its mmap, but three other mmap sites were missing these flags:
      
      - **`static_sorted_file.rs`** (`open_internal`) — SST file mmaps used for lookups and compaction
      - **`meta_file.rs`** (`open_internal`) — meta file mmaps storing AMQF filters and SST metadata
      - **`sst_inspect.rs`** (`analyze_sst_file`) — diagnostic tool mmap
      
      `MADV_DONTFORK` prevents mmap regions from being copied into child processes on `fork()`, avoiding unnecessary memory duplication and potential SIGBUS issues if the parent unmaps before the child accesses the page. `MADV_UNMERGEABLE` opts the pages out of KSM (Kernel Same-page Merging), avoiding the overhead of scanning these pages for deduplication since they contain unique compressed data.
      
      Both flags are Linux-only (`#[cfg(target_os = "linux")]`), matching the existing pattern in `read_blob`.
      
      ## Implementation
      
      Rather than duplicating `#[cfg(target_os = "linux")]` madvise calls at each mmap site, a shared helper `advise_mmap_for_persistence()` is extracted into `src/mmap_helper.rs`. The function applies both flags on Linux and is a no-op on other platforms. All four mmap sites (`db.rs`, `static_sorted_file.rs`, `meta_file.rs`, `sst_inspect.rs`) now call this single helper.
      
      ## Test Plan
      
      - `cargo check -p turbo-persistence` passes
      - `cargo fmt` clean
      - No behavioral change on non-Linux platforms (flags are gated behind `#[cfg(target_os = "linux")]`)
      83ae8ad6
  2. 05 Mar, 2026 14 commits
    • nextjs-bot's avatar
      v16.2.0-canary.81 · 16206a7f
      nextjs-bot authored
      16206a7f
    • Hendrik Liebau's avatar
      Revert legacy PPR removal (#90948) · c2bba0ea
      Hendrik Liebau authored
      This caused regressions. Apparently it was not a clean removal.
      c2bba0ea
    • Tobias Koppers's avatar
      Prefix pr-status replies with 🤖 emoji (#90943) · 2544467b
      Tobias Koppers authored
      ### What?
      
      Prefixes replies posted by `scripts/pr-status.js` with the `🤖` (🤖) emoji.
      
      ### Why?
      
      When the pr-status script replies to PR review threads, there's no visual indicator that the reply was generated by AI rather than a human. Adding the robot emoji makes it immediately clear.
      
      ### How?
      
      One-line change in the `replyToThread()` function in `scripts/pr-status.js` that prepends `🤖 ` to the reply body before posting it via the GitHub GraphQL API.
      2544467b
    • Benjamin Woodruff's avatar
      Turbopack: Annotate ReadVcFuture as must_use instead of annotating functions… · 9d0fbf13
      Benjamin Woodruff authored
      Turbopack: Annotate ReadVcFuture as must_use instead of annotating functions that return it (#90839)
      
      It's a little less error-prone if it's in one place (on the type) than in many (on the functions). I also added it to `ReadRawVcFuture`.
      
      https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
      
      - **Are these equivalent?** Yes.
      - **The** **`Future`** **trait already has this annotation, why do we need it on the type?** The annotation on the trait only applies if the function returns `impl Future` or `dyn Future`. Our functions return the named type.
      9d0fbf13
    • Benjamin Woodruff's avatar
      Turbopack: Fix some eventually consistent reads at the top level in dev-server… · 73049d6f
      Benjamin Woodruff authored
      Turbopack: Fix some eventually consistent reads at the top level in dev-server and snapshot tests (#90792)
      
      This fixes
      
      ```
      UPDATE=1 cargo test -p turbopack-tests
      ```
      
      when a snapshot test output is modified or deleted.  
        
      We must get the `Effects` inside of an operation, as that involves reading `Vc`s, but then we should apply them outside of the operation (to guarantee that they only run once). The Next.js code follows a similar pattern here.
      73049d6f
    • Luke Sandberg's avatar
      Batch require cache deletion to avoid quadratic scanning (#90625) · 3beb4665
      Luke Sandberg authored
      ### What?
      
      Rewrites `deleteFromRequireCache()` in `packages/next/src/server/dev/require-cache.ts` to accept an array of file paths and perform a single scan of `require.cache`, instead of one full scan per file. Adds a `deleteCacheBatch()` export and updates all three batch call sites to use it.
      
      ### Why?
      
      During server-side HMR, `deleteCache()` is called in loops — once per server path in the turbopack hot-reloader (5-20 files), up to 15 times per `writeManifests()` in the manifest-loader, and 2 + N times (runtime chunks + page entries) in the webpack plugin's `afterEmit` hook. Each call scans the **entire** `require.cache` to clean up parent-child references, making the overall cost O(N × C) where C is the cache size. In large apps with thousands of cached modules, this becomes a meaningful bottleneck on every HMR update.
      
      ### How?
      
      **Core change (`require-cache.ts`):** `deleteFromRequireCache` now accepts `string[]`. It resolves all paths upfront, collects target modules into a `Set<NodeModule>`, then does one scan of `require.cache` using `Set.has()` (O(1) lookup) to filter children arrays. For single-item callers (`deleteCache`), the overhead of a 1-element Set is negligible.
      
      **Call site updates:**
      - **`hot-reloader-turbopack.ts`**: Collects files to delete into an array during the `serverPaths` loop, calls `deleteCacheBatch()` once after. `clearModuleContext` stays per-file (separate system).
      - **`manifest-loader.ts`**: Adds `pendingCacheDeletes` array to `TurbopackManifestLoader`. All ~15 `deleteCache()` calls in `write*` methods become `push()` calls. Flushed at the end of `writeManifests()` with a single `deleteCacheBatch()`. Moving cache deletion to after all `writeFileAtomic` calls is safe (synchronous code, no interleaving) and slightly better (new files on disk before cache is cleared).
      - **`nextjs-require-cache-hot-reloader.ts`** (webpack): Batches the `afterEmit` hook — collects runtime chunk + page entry paths, calls `deleteCacheBatch()` once. The `assetEmitted` tap callback stays as individual `deleteCache()`.
      
      **Theoretical improvement:**
      
      | Call Site | Before (cache scans) | After | Improvement |
      |-----------|---------------------|-------|-------------|
      | turbopack `clearRequireCache` | N (5-20) | 1 | 5-20× fewer scans |
      | manifest-loader `writeManifests` | up to 15 | 1 | up to 15× fewer scans |
      | webpack `afterEmit` | 2 + page count | 1 | up to 50× fewer scans |
      
      ### Benchmark
      
      Tested with a generated 250-route app with 50 API route handlers importing server external packages (zod, lodash, express, pg, ioredis) plus middleware. API route handlers are key because unlike bundled app-router pages, they create real `require.cache` depth with native Node.js module loading.
      
      **Results (steady-state, 18 paths / 7 found / 781 nodes / ~1800 edges):**
      
      | Mode | Time per batch |
      |------|---------------|
      | **Batched** (1 scan) | **~0.24ms** |
      | **Unbatched** (18 individual scans) | **~0.70ms** |
      | **Speedup** | **~3×** |
      
      Raw data (representative samples):
      
      ```
      # Batched (1 scan of require.cache)
      [PERF] deleteCacheBatch(batch=true): 18 paths (7 found), 781 nodes, 1772 edges, 0.283ms
      [PERF] deleteCacheBatch(batch=true): 18 paths (7 found), 781 nodes, 1800 edges, 0.250ms
      [PERF] deleteCacheBatch(batch=true): 18 paths (7 found), 781 nodes, 1912 edges, 0.283ms
      
      # Unbatched (18 individual scans)
      [PERF] deleteCacheBatch(batch=false): 18 paths (7 found), 781 nodes, 1772 edges, 0.671ms
      [PERF] deleteCacheBatch(batch=false): 18 paths (7 found), 781 nodes, 1800 edges, 0.649ms
      [PERF] deleteCacheBatch(batch=false): 18 paths (7 found), 781 nodes, 1912 edges, 0.716ms
      ```
      
      The speedup scales with cache complexity — in production apps with more server externals (ORMs, validation libs, etc.) the cache would be larger and the improvement proportionally greater. With only bundled app-router pages (few edges in require.cache graph), the difference is negligible since most of the graph complexity comes from native Node.js module loading.
      3beb4665
    • Shu Ding's avatar
      Update `@vercel/og` and `satori` vendors (#90933) · dc57cde3
      Shu Ding authored
      The new `@vercel/og` and `satori` include many improvements:
      - 2~20x faster image generation (`ImageResponse` API) by using Sharp for
      rasterization, and optimized Satori core
      - Better CSS/SVG coverage:
        - https://github.com/vercel/satori/issues/736
        - https://github.com/vercel/satori/pull/734
        - https://github.com/vercel/satori/pull/733
        - https://github.com/vercel/satori/pull/732
        - https://github.com/vercel/satori/issues/728
        - https://github.com/vercel/satori/issues/724
        - https://github.com/vercel/satori/pull/717
        - https://github.com/vercel/satori/pull/718
        - https://github.com/vercel/satori/pull/719
      - Updated layout engine (https://github.com/vercel/satori/pull/689):
        - Support for `box-sizing`
        - Support for `display: contents`
        - Support for `position: static`
        - Support for `align-content: space-evenly`
        - Better support for `position: absolute`
        - Support for percentage values for `gap`
      - Noto Sans → Geist Sans
      dc57cde3
    • Andrew Clark's avatar
      Fix prefetch inlining build failure with dynamic routes (#90899) · 747d3dc4
      Andrew Clark authored
      When prefetchInlining is enabled, the segment data collection returns a
      special key for the inlined response. Previously this key was
      `/_inlined`, but the build validation code in
      `packages/next/src/build/index.ts` expects segment paths to contain
      `__PAGE__`. This caused builds to fail with "Invariant: missing __PAGE__
      segmentPath" for any dynamic route using prefetchInlining.
      
      Fix by using the same `PAGE_SEGMENT_KEY` (`__PAGE__`) constant for the
      inlined segment response key, matching what the build code already
      expects. This is consistent since the inlined response serves the same
      role as the per-page segment data — it just bundles all segments
      together.
      
      Closes #90850
      Co-authored-by: 's avatarBen Salmon <ben.salmon@daylightgroup.nz>
      Co-authored-by: 's avatarBen Salmon <ben.salmon@daylightgroup.nz>
      747d3dc4
    • Niklas Mischkulnig's avatar
      tests: Use pnpm dlx to install latest CLI version (#90923) · beb222e8
      Niklas Mischkulnig authored
      Hopefully improve flakeyness
      beb222e8
    • Joseph's avatar
      Uncached data suspense issue (#90450) · 75af3bbd
      Joseph authored
      <!-- 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
      
      ### 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
      
      
      ## 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?
      Added a new section "Opting Into Fully Dynamic Rendering" to
      `errors/blocking-route.mdx`.
      
      ### Why?
      To surface the "Suspense over body" pattern as a general solution for
      "Uncached data or connection() was accessed outside of <Suspense>"
      errors. This pattern was previously only documented in
      `next-prerender-dynamic-viewport.mdx` but is relevant to all blocking
      route errors, providing a clear opt-out for users who want fully dynamic
      rendering without granular Suspense boundaries. This directly addresses
      a common user query.
      
      ### How?
      Added a new section with a code example demonstrating wrapping the root
      `<html>` in `<Suspense>` within `app/layout.tsx`.
      
      Closes NEXT-
      Fixes #
      
      -->
      
      ---
      [Slack
      Thread](https://vercel.slack.com/archives/C07BS1WEYAZ/p1771948980142259?thread_ts=1771948980.142259&cid=C07BS1WEYAZ)
      
      <p><a
      href="https://cursor.com/agents/bc-a1a4ed9d-03cd-4241-b057-748fbf9487a9"><picture><source
      media="(prefers-color-scheme: dark)"
      srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
      media="(prefers-color-scheme: light)"
      srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
      alt="Open in Web" width="114" height="28"
      src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
      href="https://cursor.com/background-agent?bcId=bc-a1a4ed9d-03cd-4241-b057-748fbf9487a9"><picture><source
      media="(prefers-color-scheme: dark)"
      srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
      media="(prefers-color-scheme: light)"
      srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
      alt="Open in Cursor" width="131" height="28"
      src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</p>
      
      ---------
      Co-authored-by: 's avatarCursor Agent <cursoragent@cursor.com>
      Co-authored-by: 's avatarJoseph <icyJoseph@users.noreply.github.com>
      75af3bbd
    • Jimmy Lai's avatar
      Loading layout docs update (#90787) · dfbc3dc6
      Jimmy Lai authored
      <!-- 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
      
      ### 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
      
      
      ## 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?
      This PR updates the documentation to clarify the interaction between
      `loading.js` and `layout.js`.
      
      ### Why?
      To address a common point of confusion and potential blocking navigation
      issues when layouts are dynamic. It provides clear guidance on how
      `loading.js` behaves relative to layouts and how to use `<Suspense>` for
      dynamic layout parts.
      
      ### How?
      - Added a "Good to know" callout in `loading.mdx` explaining that
      `loading.js` does not wrap the layout.
      - Introduced a new "Interaction with `loading.js`" section under Caveats
      in `layout.mdx`, including an explanation and a code example for
      wrapping dynamic layout components with `<Suspense>`.
      - Added a brief "Good to know" callout in `fetching-data.mdx` for
      consistency.
      
      Closes NEXT-
      Fixes #
      -->
      
      ---
      [Slack
      Thread](https://vercel.slack.com/archives/C05KYT5S9FF/p1772239839900129?thread_ts=1772239839.900129&cid=C05KYT5S9FF)
      
      <p><a
      href="https://cursor.com/agents/bc-d69fb736-2a00-5f68-9e28-9b31c194f12a"><picture><source
      media="(prefers-color-scheme: dark)"
      srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
      media="(prefers-color-scheme: light)"
      srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
      alt="Open in Web" width="114" height="28"
      src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
      href="https://cursor.com/background-agent?bcId=bc-d69fb736-2a00-5f68-9e28-9b31c194f12a"><picture><source
      media="(prefers-color-scheme: dark)"
      srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
      media="(prefers-color-scheme: light)"
      srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
      alt="Open in Cursor" width="131" height="28"
      src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</p>
      
      ---------
      Co-authored-by: 's avatarCursor Agent <cursoragent@cursor.com>
      Co-authored-by: 's avatarJoseph Chamochumbi <joseph.chamochumbi@vercel.com>
      Co-authored-by: 's avatarDelba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
      dfbc3dc6
    • nextjs-bot's avatar
    • Tobias Koppers's avatar
      Turbopack: Tree shaking fixes and code organization (#89295) · ad030d78
      Tobias Koppers authored
      ## Summary
      
      A series of bug fixes, refactors, and code organization improvements to Turbopack's tree shaking and side effect optimization:
      
      - **Fix `ModulePart` handling for `FreeVarReference::EcmaScriptModule`** — pass `ModulePart` correctly so free variable references resolve to the right module part
      - **Extract `EcmascriptModuleRenameModule`** — split the rename/reexport logic (`RenamedExport`, `RenamedNamespace`) out of `EcmascriptModuleFacadeModule` into a dedicated `rename` module, shared between side effects optimization and tree shaking
      - **Simplify `EcmascriptModuleFacadeModule`** — now only handles the `Facade` case (locals + reexports), no longer overloaded with rename variants
      - **Reorganize tree shaking code** — moved `asset.rs` → `part/module.rs`, `chunk_item.rs` → `part/chunk_item.rs` + `side_effects/chunk_item.rs`, `side_effect_module.rs` → `side_effects/module.rs` for clearer separation between part modules and side effect modules
      - **Use `EsmExport` in `FindExportFromReexportsResult`** — reduces code duplication by reusing the existing `EsmExport` enum
      - **Minor simplifications** — code deduplication, reordered checks, and general cleanup
      ad030d78
    • Luke Sandberg's avatar
      Add trace spans for turbopack persistence in .next/trace (#90397) · 286a73f8
      Luke Sandberg authored
      ## Summary
      
      - Add a generic `TraceEvent` compilation event type that carries a name, wall-clock timing, and arbitrary attributes
      - Emit `TraceEvent` from Turbopack's Rust backend for cache persistence and compaction operations
      - Expose `eventJson` on compilation events through the NAPI bridge
      - Record `turbopack-persistence` and `turbopack-compaction` trace spans in `.next/trace` with memory usage snapshots, in both dev and build workflows
      
      ## Details
      
      Turbopack persistence and compaction operations were invisible in `.next/trace`. The only signal was a console log for operations exceeding 10s.
      
      A new generic `TraceEvent` type replaces the need for per-operation event structs. It carries a name, start/end wall-clock timestamps, and a `Vec` of key-value attributes. On the JS side, `backgroundLogCompilationEvents` handles all `TraceEvent`s with a single code path — creating trace spans via `manualTraceChild` and recording memory usage snapshots. Adding new traced operations requires only a few lines of Rust and zero JS changes.
      
      At @bgw's suggestion, I considered integrating as a `tracing_subscriber::Layer` to automatically forward spans to the compilation event system, but this ended up requiring quite a bit of code (a new subscriber, 'target' impl, span lifecycle management, new crate dependencies) for what is currently just 2 events, and we don't really anticipate adding more.
      
      ## Test plan
      
      - [x] Integration test in `test/e2e/filesystem-cache` verifying `turbopack-persistence` spans exist with correct attributes
      - [x] `pnpm test-dev-turbo test/e2e/filesystem-cache`
      - [x] `pnpm test-start-turbo test/e2e/filesystem-cache`
      286a73f8
  3. 04 Mar, 2026 24 commits
    • JJ Kasper's avatar
      Cleanup non-generic assertions in our deploy test suite (#90894) · da6fb315
      JJ Kasper authored
      This makes sure we don't have assertions that will only pass in one
      environment e.g. these should work for running against bun and not just
      node or against a local metadata URL not just a deployed https fully
      qualified domain. Ensures others can leverage this test suite for their
      own verification easily.
      da6fb315
    • nextjs-bot's avatar
      v16.2.0-canary.80 · d5b348fc
      nextjs-bot authored
      d5b348fc
    • Tobias Koppers's avatar
      Address review feedback: extract modules, clean up imports (#90813) · c83f475c
      Tobias Koppers authored
      ## Summary
      
      Follow-up to #90514 addressing review feedback from @lukesandberg:
      
      - **Extract webpack layer helpers to `webpack-layer.ts`**: Moves `shouldUseReactServerCondition` and `isWebpackAppPagesLayer` out of the large `utils.ts` into their own module, reducing transitive dependencies pulled into `swc/options.ts` (reverts the revert from the previous PR)
      - **Restore top-level import of `throwTurbopackInternalError`**: The lazy `require()` in `swc/index.ts` was unnecessary since `createProject` is always called — restores the simpler top-level import
      - **Remove dead `getSupportedBrowsers` re-export from `utils.ts`**: All importers already import directly from `get-supported-browsers.ts`, so the re-export was unused
      - **Extract `formatIssue` and `isRelevantWarning` to `format-issue.ts`**: Moves these functions (and their private helpers) out of the large `turbopack/utils.ts` into a dedicated module, so `print-build-errors.ts` doesn't pull in all of `turbopack/utils`
      
      ## Test plan
      
      - `pnpm --filter=next types` passes
      - Unit tests for `formatIssue` pass (`utils.test.ts` updated to import from new module)
      - NFT test expectations updated for the changed module graph
      c83f475c
    • nextjs-bot's avatar
      v16.2.0-canary.79 · 63292fc2
      nextjs-bot authored
      63292fc2
    • Zack Tanner's avatar
      partial fallbacks: add adapter flag (#90395) · 1c9577e3
      Zack Tanner authored
      Plumbs the new `partialFallback` through `onBuildComplete`, which is
      consumed by `adapter-vercel` to signal that a prerender is a partial
      fallback (PR forthcoming, once this lands, so it's available on the
      types). For more information on what a partial fallback is, see the
      downstack PR.
      1c9577e3
    • Zack Tanner's avatar
      [ci]: continue-on-error for more gh auth status checks (#90890) · 9ff3b7c4
      Zack Tanner authored
      This seems to be failing for our deploy test workflow
      ([x-ref](https://github.com/vercel/next.js/actions/runs/22685809647/job/65778800145)).
      
      Updating to `continue-on-error` similar to
      https://github.com/vercel/next.js/pull/89098 because this check doesn't
      seem reliable.
      
      If it fixes, will just remove in both spots all together.
      9ff3b7c4
    • nextjs-bot's avatar
      v16.2.0-canary.78 · 8bd3a2ab
      nextjs-bot authored
      8bd3a2ab
    • Vercel Release Bot's avatar
      Update Rspack development test manifest (#90858) · 8bdfe0d6
      Vercel Release Bot authored
      This auto-generated PR updates the development integration test manifest used when testing Rspack.
      8bdfe0d6
    • Vercel Release Bot's avatar
      Update Rspack production test manifest (#90857) · 5ef7b937
      Vercel Release Bot authored
      This auto-generated PR updates the production integration test manifest used when testing Rspack.
      5ef7b937
    • Jiwon Choi's avatar
    • Aurora Scharff's avatar
      chore: add aurorascharff to devex team labeler config (#90866) · 5dd02c46
      Aurora Scharff authored
      ### What?
      Add `aurorascharff` to the devex team labeler configuration.
      
      ### Why?
      New team member onboarding.
      
      ### How?
      Added username to the relevant pattern entries in the labeler config.
      
      ---------
      Co-authored-by: 's avatarvercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
      5dd02c46
    • Hendrik Liebau's avatar
      Cached Navigations: Cache runtime stage data from navigation requests (#90666) · 4b56af9f
      Hendrik Liebau authored
      When navigating to a page with `unstable_instant: { prefetch: 'runtime'
      }` and no prior prefetch (e.g. `prefetch={false}` or clicking before
      prefetch completes), the server now embeds a runtime prefetch stream in
      the dynamic RSC navigation payload. On the client, this stream is
      decoded and written into the segment cache so that subsequent
      navigations to the same page can serve runtime-prefetchable content
      (cookies, headers, searchParams) instantly, without needing a separate
      prefetch request.
      
      On the server, `generateStagedDynamicFlightRenderResult` detects routes
      with runtime prefetching enabled and attaches a `CacheSignal` and
      `PrerenderResumeDataCache` to the `RequestStore`. The dynamic render
      fills these caches as a side effect. Once `cacheSignal.cacheReady()`
      resolves, a final runtime prerender (the same 5-stage pipeline used for
      regular runtime prefetches) runs and its output is piped into a
      `TransformStream` whose readable side is included in the RSC payload as
      the `p` field on the `NavigationFlightResponse`. This avoids a separate
      prospective prerender because the dynamic render has already warmed the
      caches.
      
      On the client, `processRuntimePrefetchStream` strips the isPartial byte,
      decodes the inner Flight stream, and the result is written into the
      segment cache via `writeDynamicRenderResponseIntoCache` with
      `FetchStrategy.PPRRuntime`. Both the `navigateToUnknownRoute` and
      `fetchMissingDynamicData` code paths handle the new stream.
      
      This is gated on the explicit `unstable_instant` opt-in because it adds
      extra server processing (a full runtime prerender per navigation
      request) and increases payload size. It also requires that the runtime
      prefetch output has been validated first.
      
      Known limitation: the runtime prefetch cache write currently evicts the
      static cache entry (which may have a longer stale time) because
      `upsertSegmentEntry` treats the fallback match as a replacement target.
      This means that after the runtime cache expires, the static cache is no
      longer available as a fallback. A follow-up may address this with a
      layered cache approach where entries with different fetch strategies and
      stale times coexist independently.
      
      Extracting runtime data from initial HTML loads (the PPR resume path) is
      also deferred to a follow-up.
      4b56af9f
    • Niklas Mischkulnig's avatar
      Unify Node and Edge externals list (#90819) · a41e4d57
      Niklas Mischkulnig authored
      Unify the list of Node/Edge iexternals.
      Turns out `readline/promises` and `stream/consumers` was missing in some places.
      
      Closes https://github.com/vercel/next.js/issues/90765
      a41e4d57
    • Niklas Mischkulnig's avatar
    • Jiwon Choi's avatar
      Clean up legacy PPR references in test fixtures (#90725) · d52d9336
      Jiwon Choi authored
      Stacked on https://github.com/vercel/next.js/pull/90726
      
      Migrate legacy PPR tests to Cache Components
      d52d9336
    • Jiwon Choi's avatar
      Remove `PrerenderStorePPR` type and all `prerender-ppr` switch cases (#90721) · c37ef484
      Jiwon Choi authored
      Stacked on https://github.com/vercel/next.js/pull/90713
      
      This PR removes `prerender-ppr` case handling in the codebase.
      
      Verified deployment tests pass on CI:
      https://github.com/vercel/next.js/actions/runs/22539297668
      c37ef484
    • Hendrik Liebau's avatar
      Cached Navigations: Cache static stage of partially static initial HTML (#90539) · 5a18a71b
      Hendrik Liebau authored
      When a partially static page is loaded via initial HTML (PPR resume), the RSC payload now includes the `l` (static stage byte length) field, enabling the client router to extract and cache the static stage during hydration. Subsequent navigations to the same page serve the cached static content instantly while streaming in dynamic content.
      
      On the server, the resume path in `renderToStream` now uses staged rendering (mirroring `generateStagedDynamicFlightRenderResult`) when Cache Components is enabled. A `StagedRenderingController` separates the static and dynamic stages, and `countStaticStageBytes` resolves the byte length promise that Flight serializes into the stream as `l`. `getRSCPayload` accepts `staleTimeIterable` and `staticStageByteLengthPromise` options to wire `s` and `l` into the `InitialRSCPayload`.
      
      On the client, `app-index.tsx` tees the inlined Flight stream when Cache Components is enabled. One copy goes to React for decoding, the other is passed to `createInitialRouterState`. When `l` is present (partially static), the clone is truncated at the byte boundary via `decodeStaticStage` and written into the segment cache via `writeStaticStageResponseIntoCache` with `isResponsePartial: true`. When `l` is absent but `s` is present (fully static), the same function is used with `isResponsePartial: false`.
      
      `createInitialRouterState` now accepts a single `initialRSCPayload: InitialRSCPayload` prop instead of individual destructured fields.
      5a18a71b
    • Sebastian "Sebbie" Silbermann's avatar
    • Matt Mastracci's avatar
      Add Err(anyhow(... ast-grep rule (#90869) · 1bc8f559
      Matt Mastracci authored
      # What
      
      Add an ast-grep rule to use `bail!` rather than `Err(anyhow!(` in a
      return position.
      
      # Why
      
      This is slightly more compact, and allows us to port more code over to
      turbofmt/turbobail.
      
      Note: _this PR was previously merged into another branch due to a GH
      bug_
      1bc8f559
    • Jiwon Choi's avatar
      Remove `isRoutePPREnabled` from render options and delete dead PPR branch (#90713) · 8dd8a958
      Jiwon Choi authored
      Stacked on https://github.com/vercel/next.js/pull/90704
      
      This PR replaces `experimental.isRoutePPREnabled` render options with
      `cacheComponents` and removes unused code.
      
      Verified deployment tests pass on CI:
      https://github.com/vercel/next.js/actions/runs/22536405880
      8dd8a958
    • Hendrik Liebau's avatar
      Cached Navigations: Cache visited fully static pages in the segment cache (#90306) · 1d14e93c
      Hendrik Liebau authored
      When a fully static page is loaded (via initial HTML or client-side
      navigation), the segments are now written into the segment cache so
      subsequent navigations can be served entirely from cache without server
      requests.
      
      Initial HTML: The RSC payload inlined in the HTML is written during
      hydration via `getStaleAt` + `writeStaticStageResponseIntoCache` with
      `isResponsePartial: false`, using `FetchStrategy.Full` since all
      segments are present. A `StaleTimeIterable` (`s` field) is included in
      the `InitialRSCPayload` during the Cache Components prerender path to
      provide the stale time.
      
      Navigation: The `isResponsePartial` flag from the prepended byte
      (stripped by `processFetch`) is now also used to determine how segments
      from `writeStaticStageResponseIntoCache` are cached. For fully static
      routes (`isResponsePartial: false`), segments are written as non-partial
      so no dynamic follow-up is needed.
      
      The route tree used for cache writes is now always derived from the
      Flight data itself (via `convertServerPatchToFullTree`), rather than
      from a pre-existing route cache entry. This guarantees the tree stays in
      sync with the response and avoids key mismatches between the static
      stage tree and the per-segment prefetch tree for parallel route slots.
      
      When writing the head into the cache, `isHeadPartial` from the server is
      overridden to `false` for non-partial responses, but only when Cache
      Components is enabled. This corrects the server's conservative
      `isPossiblyPartialHead` marking during static generation. Without Cache
      Components, the server already sends the correct value. Responses
      without a recognized marker byte (e.g. regular navigations that don't go
      through the prerender path) are conservatively treated as partial.
      
      Partially static pages (where the static stage needs to be extracted via
      byte-level truncation of the initial HTML Flight stream) will be handled
      in a follow-up.
      
      ---------
      Co-authored-by: 's avatarAndrew Clark <git@andrewclark.io>
      1d14e93c
    • Matt Mastracci's avatar
      Turbopack: turbofmt/turbobail macros (#90092) · e4cae370
      Matt Mastracci authored
      # What
      Add turbofmt! and turbobail! proc macros for async string formatting
      with Vc<T> and ResolvedVc<T> values.
      
      A new, agent-friendly `FORMATTING.md` file is added to help agents
      figure out how these macros work.
      
      # Why
      
      Formatting strings that include turbo-tasks values currently requires
      manually .await?ing each Vc, then calling format!, then converting to
      RcStr via .into(). By using macros, we can reduce a lot of boilerplate
      and potentially offer some opportunities for optimizations by reducing
      intermediate, throwaway tasks.
      
      # How
      
      We make use of the "auto-deref" pattern in Rust to choose the "best"
      formatting option: ValueToString or Display.
      
      - Zero-alloc FormatIter: A shared iterator parser over format strings
      (RawString, EscapedBrace, VarRef, VarRefFormat) that both macros and the
      derive use, replacing duplicated manual parsing.
      - Borrow-based capture: turbofmt! uses async { .. } (not async move), so
      non-Copy types like FileSystemPath can be used in multiple turbofmt!
      calls without cloning.
        - Debug on StringifyType: Enables {:?} format specs in turbofmt!.
      - Converted ~30 call sites across next-core, turbo-tasks-fs,
      turbopack-core, turbopack-ecmascript, and others.
      
      # What's Left
      
      - Constants cannot be formatted with turbofmt! yet because of arcane
      Rust hygiene rules (similar issue to
      https://github.com/rust-lang/rust/issues/131446)
      - rust-analyzer doesn't show these format strings as "real" format
      strings yet because of limitations of the analyzer, but this should be
      possible to make work.
      - Automatic derive for ValueToStringRef to avoid intermediate tasks in a
      few places where formatting is trivial
       -  turbowrite!/turbowriteln! could clean up a bit more code
      e4cae370
    • Jiwon Choi's avatar
      Replace PPR config helpers with cacheComponents checks (#90704) · 70a2e8d9
      Jiwon Choi authored
      This PR replaces the legacy PPR configs in the codebase with the
      `cacheComponents` config.
      
      Confirmed deployment test passes
      https://github.com/vercel/next.js/actions/runs/22533307017
      
      ---------
      Co-authored-by: 's avatarHendrik Liebau <mail@hendrik-liebau.de>
      70a2e8d9
    • Matt Mastracci's avatar
      [turbotask] Make turbotask function registration const (#90797) · 5719439f
      Matt Mastracci authored
      # What 
      
      Make turbotask function registration const -- all function registration
      blocks are true &'static items, compiled directly into the binary.
      Removes a few thousand allocations of type names and boxed impls of
      TaskFn.
      
      # Why
      
      We have approx 2k functions, so the cost of Lazy construction +
      temporary allocations adds up (even with compiler optimization). This
      also unlocks the opportunity for further startup optimizations (in later
      PRs).
      
      # How
      
      The `#[turbo_tasks::function]` macro now generates static items
      initialized directly with const fn constructors instead of `Lazy::new(||
      ...)`, using `const { &into_task_fn(f) as &dyn TaskFn }` blocks to
      produce `&'static dyn TaskFn` trait objects at compile time from
      zero-sized function items.
      
      Global names that previously required runtime format!() + Box::leak()
      are now computed at compile time via `const_type_name()` (a const
      wrapper around `std::any::type_name`) and a `const_concat!` macro that
      concatenates string slices into a fixed-size byte array.
      
      The NativeFunction struct, ArgMeta, and the
      into_task_fn/into_task_fn_with_this wrappers are all const
      fn-constructible, with input types inferred through a TaskFnInputs trait
      that maps wrapper types to their argument tuples (we use a non-allocated
      and non-compiled temporary "duplicate" `TaskFn` instance that is only
      useful for type inference in a const context).
      
      # Next Steps
      
      I believe we can remove the const `type_name` in favour of the const
      `type_id` and instead pull function names only when needed for display
      purposes. This will show up in a future PR.
      
      We can also remove non-const registration for things that aren't
      functions as well, though I believe this is less important.
      5719439f