1. 01 Oct, 2026 6 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.55 · fbd032ff
      next-js-bot[bot] authored
      fbd032ff
    • Niklas Mischkulnig's avatar
      Always use generateBuildId if set explicitly (#99147) · b8a7d931
      Niklas Mischkulnig authored
      https://github.com/vercel/next.js/pull/89325 changed the build id to be
      a hardcoded constant if `config.deploymentId` is set (= skew protection
      is enabled)
      This was done as an optimization (more deterministic build outputs)
      
      Instead, always use generateBuildId if set explicitly and only use the
      new behavior if `generateBuildId` isn't set.
      
      Closes https://github.com/vercel/next.js/issues/92154
      
      ---------
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      b8a7d931
    • Luka Hartwig's avatar
      Set tracer library version (#98262) · a8ada873
      Luka Hartwig authored
      ### What?
      
      Sets the correct Next.js library version for Otel traces.
      
      ### Why?
      
      The tracer instance was configured with a hard coded "0.0.1" library
      version. This is confusing since it makes it look like trace spans were
      produced by `next@0.0.1`. Instead I'm setting the library version to the
      current Next.js version.
      
      ### How?
      
      I'm using the `__NEXT_VERSION` env var, which gets replaced by the
      package.json version during build.
      a8ada873
    • Zakharii (Zakhar) Melnyk's avatar
      fix: propagate repeated tag revalidation from after() (#99499) · 315f1f45
      Zakharii (Zakhar) Melnyk authored
      ## What
      
      Propagate a repeated revalidation of the same tag and profile from an
      `after()` callback when its timestamp advances during the request. Add
      an E2E test that refills the tagged cache entry between the two calls.
      
      ## Why
      
      `revalidateTag()` updates `revalidatedAt` on an existing pending item in
      place. `withExecuteRevalidates()` currently saves a shallow copy of that
      item, and `diffRevalidationState()` only compares tag and profile. The
      second call is therefore dropped, leaving an entry refilled between
      calls stale. The reproduction uses the built-in cache handler and
      returns `{ source: 2, cached: 1 }` where `{ source: 2, cached: 2 }` is
      expected.
      
      ## How
      
      Snapshot the pending tag items and compare `revalidatedAt` for matching
      tag/profile pairs. The regression test holds the `after()` callback
      until a request has refilled the cache, then checks that the final read
      is fresh.
      
      The production reproduction passed with the equivalent runtime change on
      `next@16.4.0-canary.53`. `git diff --check` passed. The full monorepo
      E2E suite has not been run locally.
      
      Fixes #99498
      315f1f45
    • Janka Uryga's avatar
      Stabilize `ensureStatic` (#99513) · 13b59c9e
      Janka Uryga authored
      Closes NAR-933
      
      Drop the `unstable_` prefix from `ensureStatic`, because we're
      reasonably confident that the API shape won't change.
      13b59c9e
    • Benjamin Woodruff ‮'s avatar
      Turbopack: Enable experimental.turbopackSharedRuntime by default (#99504) · 07d0c905
      Benjamin Woodruff authored
      This has been on in canary for over a month with zero issues, [nobody
      within vercel has opted out of
      it](https://github.com/search?q=org%3Avercel+turbopackSharedRuntime&type=code),
      let's turn it on-by-default for 16.4!
      
      Leaving the flag around for now in case anybody needs to turn it off,
      but the current plan is to delete this flag (and the non-shared runtime
      codepath) in a future release.
      07d0c905
  2. 30 Sep, 2026 24 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.54 · 7a97071d
      next-js-bot[bot] authored
      7a97071d
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Luke Sandberg's avatar
      turbo-persistence: intermediate merges take the newest files of similar size (#99433) · 7c5dbd19
      Luke Sandberg authored
      ## Summary
      
      Stacked on #99268.
      
      An intermediate merge merged every file above a shard's bottom run.
      Small commits, such as the snapshots of a development session, write
      small files: they push a shard over `max_files_above_bottom` quickly,
      and the merge then rewrote the large files of earlier build-sized
      commits along with them.
      
      Like the size ratio of RocksDB's universal compaction, an intermediate
      merge now takes the newest file, and then each next older one while it's
      at most `size_ratio_percent` (default 100%) larger than the files taken
      so far, with at least the two newest. Small files are merged with each
      other; a large file only joins once the newer files add up to about its
      size. Because the merge always takes the newest files, its output can
      still be placed after all existing files, and the older files it leaves
      out stay older.
      
      The trigger (`max_files_above_bottom`) and bottom merges are unchanged.
      
      ## Verification
      
      - A selector simulation where every build-like commit is followed by ten
      tiny commits: write amplification **6.43 → 1.98**, with the same maximum
      of 5 files per shard. The build-only simulation is unchanged (space
      amplification 1.34, write amplification 1.25).
      - Selector tests: small files after a large one merge without it;
      similar sizes all merge; steeply growing sizes merge at least the two
      newest; the ratio boundary.
      - `cargo test -p turbo-persistence`, `cargo test -p turbo-tasks-backend
      --tests`, and the Miri job's command for turbo-persistence pass.
      - End to end, 31 consecutive vercel-site builds with GC on (about half
      the TaskData commits are small), against #99268:
      
        | | #99268 | this PR |
        |---|---|---|
      | compaction bytes written per byte committed | 1.61× (12.52 GB) |
      **1.45×** (10.99 GB) |
        | …by intermediate merges | 3.69 GB | **2.34 GB (−37%)** |
        | …by bottom merges | 8.82 GB | 8.66 GB |
        | cache size, final / max | 2.94 / 3.24 GB | 2.92 / 3.13 GB |
      
      Intermediate merges run more often (126 vs 104 TaskData jobs) but each
      rewrites less. A development session, with many small snapshot commits,
      should benefit more.
      
      <!-- NEXT_JS_LLM -->
      7c5dbd19
    • Luke Sandberg's avatar
      turbo-persistence: space-amplification driven compaction with adaptive hash shards (#99268) · 08d7a524
      Luke Sandberg authored
      ## Summary
      
      Turbo-tasks GC can only shrink the persistent cache if compaction merges
      each tombstone with the data it deletes. Canary's compaction algorithm
      leaves many tombstones behind so with GC enabled the cache is only 5%
      smaller than without it. This PR replaces compaction with a
      space-amplification policy on hash shards, modeled on RocksDB universal
      compaction and Cassandra UCS. With GC enabled, the cache stays ~flat.
      
      ### Cache size over 31 consecutive vercel-site builds
      
      Same canary base and the same commits in every arm. The size is measured
      after each build, including its compaction on shutdown.
      
      | build | canary, GC off | canary, GC on | this PR, GC off | this PR, GC
      on |
      |---|---|---|---|---|
      | 1 | 2.59 GB | 2.60 GB | 2.63 GB | 2.64 GB |
      | 10 | 3.15 GB | 3.12 GB | 3.24 GB | 3.07 GB |
      | 20 | 3.42 GB | 2.92 GB | 3.20 GB | 3.06 GB |
      | 22 | 4.57 GB | 3.87 GB | 3.55 GB | 3.18 GB |
      | 31 | **4.19 GB** | **3.96 GB** | **3.75 GB** | **3.00 GB** |
      | growth, build 1 → 31 | +1.60 GB | +1.36 GB | +1.12 GB | **+0.36 GB** |
      
      - **GC saves 5% with canary's compaction and 20% with this one** (final
      size, GC on vs. off). A full compaction of the final cache puts the live
      data at about 2.8 GB, so this PR with GC is within about 8% of it.
      - **Build 22 rewrites a lot of task data.** Canary grows by about 1 GB
      at that build in both modes and never recovers the space. This PR
      absorbs it and merges the superseded versions away within a few builds.
      
      ### Why canary's compaction can't keep up with GC
      
      - **Old versions and tombstones don't reliably meet the data they
      supersede.** Canary wrote recently read keys and the rest into separate
      warm and cold files and never merged across them.
      - **Its merge triggers couldn't see the duplication.** There were
      duplication-byte thresholds and `max_merge_bytes`. Most of the garbage
      is superseded versions of a relatively small set of large, frequently
      rewritten `TaskData` values, so those triggers missed it and produced
      inefficient merge groups.
      
      ### New Compaction policy
      - **Shards:** each family's key space is split into power-of-two
      hash-prefix shards. The count starts at
      `FamilyConfig::initial_shard_bits` (TaskData 8 shards, TaskMeta 4,
      TaskCache and Infra 1) and then follows the family's size, targeting
      about 256 MB per shard.
      - It doubles once shards exceed 1.5× the target and halves below 0.5×,
      so a size near a boundary doesn't flip it.
      - Commits and merges split SST files at shard boundaries, so each shard
      is compacted on its own. Files written with an old count are re-split by
      their shard's next merge, not by a rewrite.
      - Write batches still buffer a family in at most 4 collectors (64 MB
      each) as on canary, split by a prefix of the shard bits, so their memory
      doesn't grow with the shard count. Families with more than 4 shards
      write proportionally smaller commit files.
      - **Bottom merge:** when the files above a shard's bottom run exceed 50%
      of it, the whole shard is merged into a new bottom run. Tombstones count
      as the entries they delete. This is the merge that reliably drops
      superseded entries and tombstones.
      - This is analogous to a 'full compaction' but it targets a single shard
      and is targeting files covering typically <0.5G of data.
      - **Intermediate merge:** more than 4 files above the bottom run are
      merged together, which bounds the number of files a lookup consults.
      - **Budget:** bottom merges per family stop after rewriting 3× the
      family's fresh (not yet compacted) bytes, so cost follows new writes and
      shards spread over multiple compactions. 3× is how often a written byte
      is copied in steady state: a bottom merge at the 50% trigger rewrites
      1.5× the bytes above the bottom run for every 0.5× of them.
      - **Hard cap:** a shard over twice the trigger (100% space
      amplification), or with more than twice `max_files_above_bottom` files
      above its bottom run, is bottom-merged even when the budget is spent.
      This bounds how far a shard can fall behind, e.g. after a GC purge: its
      tombstones count as the entries they delete, but they're small and give
      little budget.
      - **Tiny families:** a 1 MB floor keeps families like Infra, which
      rewrite ~everything on every commit, out of bottom merges.
      - **Ranking:** jobs are ranked across families by how far over their
      trigger they are, so intermediate merges aren't starved.
      
      **Hot/cold split, only in bottom merges.** A bottom merge writes
      recently read keys and the rest into separate hot and cold files. It
      always includes every file of its shard, hot and cold, so this does not
      interfere with deduplication. Used-key tracking is unchanged from
      canary: each commit records the keys it read in its meta file, and
      compaction uses the union of all live meta files. The marks are never
      copied into meta files written by compaction, so they expire with the
      commit that recorded them.
      - This Hot/cold split is less aggressive than canary. See below for Read
      locality impacts.
      
      **Reads:** a lookup only consults the SST files of its key's shard. A
      per-family index keeps each shard's hash ranges densely, newest first,
      so lookups scan them sequentially.
      
      ## Verification
      
      - The cache size benchmark above: vercel-site, 31 commits, GC with
      `rootTtlMs=0`. Earlier runs on the same base reproduce the GC-on results
      (canary 3.93–3.99 GB, this PR 3.00–3.05 GB).
      - **Read locality**, measured with temporary instrumentation that isn't
      part of this PR. It counts the distinct SST blocks each build reads, and
      the distinct 128 KiB file regions they touch as an estimate of squashfs
      decompression. Same base, same builds, builds 2–31, GC on:
      
        | | canary | no split | this PR (bottom split) |
        |---|---|---|---|
      | distinct blocks read per build, median | 1.35 GB | 1.80 GB | 1.55 GB |
      | 128 KiB regions touched per build, median / total | 2.42 / 64.2 GB | —
      | 2.63 / 68.8 GB |
      
      The bottom split recovers most of the locality that dropping the split
      cost. Light builds still read about a third more than on canary, because
      a shard's hot set only refreshes at its bottom merge. Splitting
      intermediate merges as well gained about 1%, so it isn't included.
      - **Lookup microbenchmark**, 16 shards × 20 uncompacted commits (320
      SSTs), alternating before and after: `get` hit −14%, miss −28%,
      `batch_get` −5%.
      - `cargo test -p turbo-persistence` and `cargo test -p
      turbo-tasks-backend --tests` pass. The selector has unit tests, and a
      simulation whose sweep supports the 50% threshold.
      
      <!-- NEXT_JS_LLM -->
      08d7a524
    • Jamiboy Mohammad's avatar
      test: enable basePath redirect deployment coverage (#99401) · bd932b38
      Jamiboy Mohammad authored
      ## Summary
      
      Re-enable `gssp-redirect-base-path` deployment coverage with Corepack so
      installation uses the fixture's declared pnpm version.
      
      A redirect with `basePath: false` lands at `/404`, outside the
      application's `/docs` base path. Vercel may serve its own 404 page
      there. Check the destination URL and the browser's actual HTTP 404
      navigation response in every mode, while retaining the custom-page text
      assertion for self-hosted modes. This follows the existing base-path
      error-page tests; the other redirect assertions remain unchanged.
      
      Follow-up to #99192.
      
      ## Verification
      
      - All 22 tests passed locally in production Turbopack mode, both
      normally and with `__NEXT_CACHE_COMPONENTS=true` and
      `__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true`.
      - Normal and cache-components deployment manifests select the suite
      without excluding individual cases. Deployment execution awaits CI.
      - The repository TypeScript check is blocked by the worktree's shared
      `node_modules` resolving an older Next.js build in another checkout
      (missing upgrade and static-config exports); it reported no errors in
      the changed test.
      
      <!-- NEXT_JS_LLM -->
      bd932b38
    • Orkhan Rzazade's avatar
      fix(incremental-cache): keep an ISR entry's cache lifetime across instances and restarts (#99289) · 90305124
      Orkhan Rzazade authored
      ### What?
      
      An on-demand ISR page (dynamic route with `revalidate`, not prerendered
      at build) loses its `Cache-Control` header when the process serving it
      from the cache is not the one that rendered it. That happens with
      several instances sharing a cache handler, and with a single instance
      after a restart, including the default file-system cache.
      
      After a restart it is also served `STALE` on every request, because
      `calculateRevalidate` falls back to its 1-second default.
      
      A running instance can also retain an outdated lifetime after another
      instance replaces the shared entry with a shorter-lived result.
      
      ### Why?
      
      `IncrementalCache.get()` takes an entry's lifetime only from
      `SharedCacheControls`: an in-memory map that `IncrementalCache.set()`
      fills in the same process, with the prerender manifest as fallback. An
      on-demand page of a dynamic route is not in the manifest. So any other
      process has no lifetime for the entry, sends no header, and treats the
      entry as stale after one second.
      
      ### How?
      
      - `CacheHandlerValue` gets an optional `cacheControl`. Handlers already
      receive it as `ctx.cacheControl` in `set()`; now they can return it from
      `get()`.
      - In `IncrementalCache.get()`, the lifetime returned with the entry
      takes precedence over the in-memory map and is remembered for the route,
      so both the response header and revalidation use the entry's current
      lifetime.
      - The default `FileSystemCache` stores `cacheControl` in the `.meta`
      file of App Router pages and routes, and returns it.
      
      Pages Router ISR is not covered: the file-system cache writes no `.meta`
      for it. I kept that out of this PR.
      
      ### Tests
      
      `test/production/app-dir/isr-cache-control-restart` contains three
      separate on-disk fixture apps:
      
      - `default`: the built-in file-system cache, with `cacheComponents:
      false`.
      - `custom`: a persistent custom cache handler that stores
      `ctx.cacheControl`, with `cacheComponents: false`.
      - `cache-components`: `cacheLife` with a persistent custom route-cache
      handler, covering the same on-demand route-cache path with Cache
      Components enabled.
      
      The three restart cases render an on-demand page, age the entry beyond
      two seconds, and restart the server without rebuilding. The first
      response after restart must retain the original `Cache-Control` and
      report `HIT`; a repeat request must also report `HIT`. Aging past the
      broken one-second fallback makes the freshness assertion meaningful.
      
      A fourth test keeps servers A and B running from the same build with one
      shared cache handler and a controllable service. A first caches a
      success with a one-hour lifetime. After direct eviction from the shared
      store, B caches an error result with a two-second lifetime. A must use
      the replacement entry's shorter `Cache-Control` and report `STALE` after
      two seconds. Direct eviction avoids relying on the fixture handler's
      no-op tag invalidation.
      
      All four tests pass locally with Webpack and with Turbopack under
      `__NEXT_CACHE_COMPONENTS=true`. The new two-server test catches the
      previous implementation retaining A's one-hour lifetime. The three
      restart cases were also verified to fail on the original PR base
      (`1cc0f661`) with `STALE` instead of `HIT`. Prettier, ESLint, the root
      and Next.js type checks, and the full repository build pass.
      
      The local validation above ran on `7adcd57b`, before the subsequent
      merge of `canary` (`d093eb45`). That merge preserved the changed
      incremental-cache files and fixtures.
      
      Fixes #99288
      
      ---------
      Co-authored-by: 's avatarorzazade <orzazade@users.noreply.github.com>
      90305124
    • Josh Story's avatar
      Avoid mutating image qualities during validation (#99476) · a5cf7ef1
      Josh Story authored
      ## Summary
      
      Allow the internal blur quality directly during development image
      request validation instead of appending it to `images.qualities`. This
      preserves quality validation while removing another runtime config
      mutation as part of supporting immutable configuration in Vercel adapter
      deployments.
      
      ## Verification
      
      Existing HTTP tests in `test/e2e/image-optimizer/sharp.test.ts` cover
      blur SVG responses, allowed image requests, and rejection of
      unconfigured qualities. The four selected cases pass in Turbopack
      development, Webpack development, and Webpack production modes.
      
      <!-- NEXT_JS_LLM -->
      a5cf7ef1
    • Josh Story's avatar
      Remove the Cache Components deployment-test alias (#99446) · 423315a7
      Josh Story authored
      ## Summary
      
      Remove `NEXT_PRIVATE_EXPERIMENTAL_CACHE_COMPONENTS` to simplify how
      deployment tests enable Cache Components. Capture
      `__NEXT_CACHE_COMPONENTS` in the generated test config instead,
      preserving deployment coverage and explicit config overrides without a
      separate environment-variable alias.
      
      ## Verification
      
      - `pnpm test-unit
      test/unit/next-deploy-failure/next-deploy-failure.test.ts
      --runTestsByPath --runInBand` — 19 tests passed.
      - Loaded nine generated configs in fresh processes: enabled, disabled,
      and unset test flags crossed with enabled, disabled, and unset
      `cacheComponents` config. Flag propagation and explicit config overrides
      were preserved.
      - Live Vercel deployment tests passed against the preview package for
      `654cad9519ce5af015d3cdbe23dd8ed1538662b8`, using Turbopack and
      `__NEXT_CACHE_COMPONENTS=true`: `not-found-non-document-dynamic` (4
      tests, inherited flag) and `prefetch-inlining-no-cache-components` (3
      tests, explicit opt-out). The inherited-flag build enabled Cache
      Components and produced partial prerenders.
      
      <!-- NEXT_JS_LLM -->
      423315a7
    • Josh Story's avatar
      Finalize the App Router dev indicator on output completion (#99384) · b61c8e24
      Josh Story authored
      ## Summary
      
      Continue removing request-event dependencies from App Router rendering.
      The request body's `end` event is not a render-completion signal and may
      already have fired before a custom server invokes Next.
      
      Keep the dev indicator Pending until HTML or Flight output completes,
      then classify from render-phase dynamic API usage and route
      configuration, including usage discovered during Client Component SSR.
      Completion handling stays local and dev-only, without shared lifecycle
      callbacks or stream helper APIs.
      
      Actions and prefetches do not reclassify the page. HEAD requests
      preserve the last completed classification because their output is not
      consumed. Pages Router and Cache Components behavior is unchanged.
      
      ## Verification
      
      - Gated browser regressions fail before the change and pass afterward,
      including a Client Component that calls `unstable_noStore()` after
      suspending during SSR.
      - All 21 dev-indicator tests pass in each combination of
      Turbopack/Webpack and Cache Components on/off.
      - Isolated `pnpm test-start-webpack
      test/e2e/app-dir/app/standalone.test.ts` passes (2/2).
      
      <!-- NEXT_JS_LLM -->
      b61c8e24
    • Hendrik Liebau's avatar
      [test] Cover external `next/image` in adapter deployments (#99466) · 1cfcc177
      Hendrik Liebau authored
      The existing `image-from-node-modules` fixture renders `next/image` when
      Next.js prerenders its static page. It does not render the external
      image component during an SSR request, when an adapter deployment loads
      image configuration from the frozen `required-server-files.json`
      manifest. This change adds a `getServerSideProps` route, keeps
      `my-cool-image` external, and configures two `images.deviceSizes`.
      Before #99394, the adapter deployment fails when `next/image` sorts the
      frozen manifest configuration.
      1cfcc177
    • Josh Story's avatar
      Prepare image options without mutating configuration (#99394) · 4593aec0
      Josh Story authored
      ## Summary
      
      Image helpers and components sort arrays from their configuration, which
      fails when that configuration comes from a frozen deployment manifest.
      Prepare owned image options once and reuse them across rendering and
      `getImageProps`. This supports immutable Next.js configuration in Vercel
      adapter deployments.
      
      Modern and legacy Image components share a `useImageConfig` hook that
      preserves existing configuration selection and SSR `localPatterns`
      validation. `getImageProps` prepares its fixed options once at module
      initialization without context.
      
      ## Verification
      
      Existing local-pattern, query-string validation, and custom-loader
      production fixtures pass with Webpack and Turbopack. Development checks
      cover local patterns, legacy remote-image rejection, and the
      static-export diagnostic with both bundlers.
      
      <!-- NEXT_JS_LLM -->
      4593aec0
    • Janka Uryga's avatar
      [PPF] Use RDC in runtime prerenders (#98025) · d7a18cc1
      Janka Uryga authored
      Runtime shell prefetch requests were ignoring the provided RDC. I'm not
      sure what the history was, i.e. whether this was introduced when
      unifying RDCs like #98005 or if it was like that from the start, but
      this PR fixes it.
      
      (the added tests were failing before the fix)
      d7a18cc1
    • Janka Uryga's avatar
      [PPF] Use RDC in cachedNavigations codepaths (#98005) · 69219b49
      Janka Uryga authored
      Closes NAR-954
      
      In Partial Prefetching, the embedded runtime stream codepath awas
      accidentally dropping the RDC. This PR fixes this by prefilling the
      mutable cache from the RDC. we ungate the failing tests introduced in
      #99417 and add some more e2e ones.
      
      As a drive-by improvement, i've also moved the `cacheReady()` call to
      happen after the main render runs through all the stages. It's pretty
      strange to call `cacheReady()` before we've even started the render that
      might fill any caches. I'm guessing it works because the code in-between
      runs quickly enough, but it's still a potential race and we shouldn't do
      it.
      
      ### How this bug got introduced
      
      In #94194 we accidentally started clobbering the resume data cache in
      the `cachedNavigations` codepath (i.e. when rendering the embedded
      runtime prefetch stream).
      This assignment used to be non-destructive because
      `prerenderResumeDataCache` was separate:
      
      https://github.com/vercel/next.js/blob/b0420899b68a4f7506fdbc93ff5acf6edcfa3d3c/packages/next/src/server/app-render/app-render.tsx#L969-L972
      But after unifying `prerenderResumeDataCache` and
      `renderResumeDataCache`, we started essentially dropping the RDC and
      using an empty one
      
      https://github.com/vercel/next.js/blob/8c661813a1e66cd85b795e3aeae0f04ae3e3201e/packages/next/src/server/app-render/app-render.tsx#L970-L973
      This wasn't caught because the tests that checked RDC behavior weren't
      exercising this codepath (at the time: no `cachedNavigations` + runtime
      prefetch opt in, and later on no `partialPrefetching` opt in)
      69219b49
    • Janka Uryga's avatar
      test: add PPF coverage to use-cache and RDC tests (#99417) · 562d3e7f
      Janka Uryga authored
      We weren't running the use-cache/resume-data-cache test suites in PPF.
      some of the tests fail due to the bug that is fixed in #98005 (although
      interestingly the fetch-cache tests only fail in deploy mode, because in
      `next start` we heal a bad RDC using outputs from
      `.next/cache/fetch-cache`). a bunch of refactoring was needed (some
      tests were producing false negatives, flakily), so i split this into a
      separate PR to confirm behavior before/after the fix.
      
      ### `use-cache.test.ts`
      
      - I've refactored the tests to use timestamps and be a bit more
      debuggable. previously, they'd fail with a hydration error, and it was
      hard to pinpoint the cause. including a name lets us know which cache
      was mismatched, and assert that the values of the cache are consistent
      across the HTML shell / resume.
      - the tests for exluded caches now include more complete assertions on
      what content is and isn't included in the HTML shell
      
      ### `resume-data-cache.test.ts`
      
      This one needed quite a bit of work:
      
      - The `use cache` and `fetch cache` tests were not independent. they
      both used the same page and revalidated the same tag, which means that a
      revalidation from the first test affected the outcome of the second
      test. i've split them into two separate pages with two separate tags to
      make the behavior consistent.
      - Multiple tests fetched the same URL (with `fetch(..., { cache:
      'force-cache' }`), which made them interfere with each other's fetch
      caches. the URLs are now different so the tests are actually independent
      - Some cache values are now tagged with a name and timestamp. The name
      is used for asserting consistency, the timestamp is for improved
      debuggability (provides ordering)
      - The action revalidation tests weren't checking what the value from the
      build-time prerender was actually supposed to be, so they were passing
      even if the build-time RDC was not used at all
      - The tests that use `browser()` now assert that there should be no
      hydration warning, which can happen due to the PPF bug (due to
      inconsistent cache values across HTML shell/resume)
      - **the revalidation assertions are very flaky in deploy**, and i've had
      to disable them to avoid introducing a test that fails often. i'm not
      sure how they were passing before.
      562d3e7f
    • Jiwon Choi's avatar
      Restore static metadata prerendering for dynamic routes (#99463) · 8f4e4b64
      Jiwon Choi authored
      Static metadata files nested under dynamic routes use placeholder paths
      with empty params. The build treats those routes as missing
      `generateStaticParams()`, which breaks adapter deployments.
      
      This is a temporary hotfix, will follow up with better refactor of the
      handling
      8f4e4b64
    • Aurora Scharff's avatar
      Exclude metadata files from route handler type validation (#99377) · 7297fe2a
      Aurora Scharff authored
      ## Summary
      
      Metadata files such as `app/icon.tsx` export a default handler, rather
      than HTTP methods. Validating them as ordinary route handlers rejects
      the documented `size` and `contentType` exports with TS2559 during `next
      typegen` + `tsc`.
      
      Exclude metadata files from ordinary route-handler validation in both
      validator modes by matching the `route.<extension>` file convention,
      including custom page extensions. Add an icon fixture with the
      documented exports and a regression test that checks generated
      validation, retains an ordinary route-handler control, and runs `tsc`.
      
      Correct the existing non-strict invalid-page-props assertion as well.
      The same failure reproduces on the unchanged base commit: non-strict
      `AppPageConfig` accepts arbitrary props, so the per-page check emits the
      invalid-props diagnostic instead. The test still requires a failed build
      and the specific invalid-props error; strict mode retains its
      `AppPageConfig` assertion.
      
      ## Verification
      
      - Reproduced the stale assertion on unchanged base commit `3932a6bd`:
      12/13 tests passed, with only invalid-page-props failing.
      - Full Webpack validator suite: **14/14 passed** in normal mode and
      **14/14 passed** with `__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES=true`.
      Both runs include the icon regression and invalid ordinary-handler
      checks.
      - Core Next.js build (including types), formatting, and ESLint passed.
      - Direct before/after checks verified that both generators exclude
      metadata files while retaining ordinary and custom-extension route
      handlers.
      - Tests use `NEXT_SKIP_ISOLATE=1` because the isolated install cannot
      resolve the configured package registry. Full bootstrap in the temporary
      worktree hit environment restrictions; the core package build passed.
      
      <!-- NEXT_JS_LLM -->
      7297fe2a
    • Jiwon Choi's avatar
      Remove `true` from `agentUpgrade` option (#99461) · df0228d4
      Jiwon Choi authored
      Set `'security'` to be the default.
      df0228d4
    • Siam's avatar
      fix: revalidateTag not reaching custom cache handlers when profiles differ (#99359) · a1de339f
      Siam authored
      Fix `updateTags` skipping cache handlers when a request uses multiple
      cache profiles.
      
      ## Why
      
      `getCacheHandlers()` returns a one-time iterator. When tags are grouped
      by profile, the first group consumes the iterator, so subsequent groups
      don't reach any handlers.
      
      This is especially noticeable with custom cache handlers, where tags may
      not be propagated to other instances.
      
      ## How
      
      Convert the handlers iterator to an array once and reuse it for each
      profile group.
      
      ## Test
      
      Added an E2E test covering `updateTag()` and `revalidateTag()` with
      different profiles.
      
      Fixes #99352
      
      ---------
      Co-authored-by: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
      a1de339f
    • Jiwon Choi's avatar
      Enable agent upgrade reminders by default (#99311) · 50e90fb7
      Jiwon Choi authored
      ### Why?
      
      Enable agent upgrade reminders by default and give the experimental
      Future Defaults policy a clear name.
      
      ### How?
      
      Rename `experimental.agenticAutoUpgrade` to `experimental.agentUpgrade`
      across config, runtime, docs, tests, and evals. Default it to `true`,
      which normalizes to the `security` policy while preserving explicit
      policies and `false`. Rename the `future` policy value to
      `experimental-future`, reuse the development advisory assessment, and
      preserve CI agent reminders.
      
      <!-- NEXT_JS_LLM -->
      
      Closes NAR-940
      50e90fb7
  3. 29 Sep, 2026 10 commits
    • Jamiboy Mohammad's avatar
      Enable deploy tests for reusable fixture variants (#99404) · 3854a984
      Jamiboy Mohammad authored
      ## Summary
      
      Enable deploy tests for the six remaining fixture-reuse files: the
      conflict/group not-found routes, missing-Suspense and browser-bailout
      variants, dynamic optional routing, and both middleware source-location
      suites. Prepare each production variant before startup instead of
      patching, renaming, cleaning, or rebuilding the same fixture.
      
      Remove the file-level deployment skips while preserving every production
      assertion and the existing dev file-mutation checks. Failed builds use
      rejected startup with the same diagnostics; static-export tests check
      the same warning after a local build or deployment. Forward the
      browser-bailout flag explicitly to remote builds.
      
      The middleware static-export fixtures explicitly disable Cache
      Components and its dependent cached navigations flag, since static
      export does not support PPR; both suites still execute their full build
      and warning assertions in the Cache Components CI jobs.
      
      ## Verification
      
      - Turbopack and Webpack production runs: 7 test entry points and 45
      tests passed in each, including the browser-bailout wrapper.
      - Turbopack and Webpack dev runs: 5 applicable entry points and 43 tests
      passed in each; the two existing production-only skips are unchanged.
      - TypeScript, ESLint, and Prettier passed.
      - Additional Cache Components runs: both Suspense variants passed with
      both bundlers. The two not-found files reproduce their existing
      incompatibilities (Edge runtime; the conflict fixture also uses an
      unguarded timestamp) and retain their existing Cache Components manifest
      exclusions. No new skips are added.
      - Reproduced all four middleware static-export failures with the Cache
      Components CI feature flags. After the fixture fix, both suites pass all
      four cases with Turbopack and Webpack under those flags.
      - Standard deploy CI passed. Local deploy verification is blocked by the
      Vercel project permissions; the corrected Cache Components deploy cases
      await the new CI run.
      
      <!-- NEXT_JS_LLM -->
      3854a984
    • Jamiboy Mohammad's avatar
      test: enable compatible body-size cases in deploy (#98911) · 0abfbcbc
      Jamiboy Mohammad authored
      ## Summary
      
      Based on #99392. Stack: #99012 → #98994 → #99392 → #98911. This PR now
      contains its own `skipDeployment` → `@force-gate` conversions and
      removal of `skipped` returns, with no dependency on Josh’s migration
      PRs. Enable only the two body-size tests confirmed passing in both
      deployment CI variants: a 4 MiB request with a 5 MiB Next.js buffer and
      a 1 MiB request with a 2 MiB buffer.
      
      Keep the other seven tests gated and replace the migration TODOs with
      verified reasons:
      - The test deployment enforces the documented 4.5 MB Vercel payload
      limit. Requests of 5, 6, 10, 11, 20, and 51 MiB receive HTTP 413,
      independently of the Next.js buffering setting.
      - The 3 MiB request is accepted, but Vercel forwards the entire body
      instead of applying Next.js's local 2 MiB truncation.
      
      The 5 MiB and 2 MiB suite gates are narrowed to their failing over-limit
      tests. All test bodies and assertions are unchanged. The redundant
      dev-only image exclusion is handled separately in #98908.
      
      ## Verification
      
      - Restacked above #99392; `git range-diff` confirms the body-size patch
      is unchanged.
      
      - Prettier and ESLint passed.
      - Verified test bodies and assertions are unchanged after removing the
      legacy deployment skips; all four force-gates attach. A collection-only
      check with fixture setup stubbed confirms two tests enabled and seven
      gated in deploy, and all nine enabled locally.
      - Prior reproduction on canary:
      https://github.com/vercel/next.js/actions/runs/35401223346/job/105783820893
      and
      https://github.com/vercel/next.js/actions/runs/35401223346/job/105783820915
      (2 passed, 7 failed in each).
      - Direct HTTP reproduction returned Vercel's FUNCTION_PAYLOAD_TOO_LARGE
      for 5 MiB with a configured 50 MiB Next.js buffer; 4 MiB succeeded.
      - Full suite execution remains blocked by the local installation’s
      missing `node-fetch`; bootstrap/watch builds stalled during the
      first-layer validation. CI must validate execution on the new stack.
      
      <!-- NEXT_JS_LLM -->
      0abfbcbc
    • Jamiboy Mohammad's avatar
      test: retain deploy exclusions for local process control (#99392) · 84dd9be7
      Jamiboy Mohammad authored
      ## Summary
      
      Retain the deployment exclusions for two suites that require control of
      the local Node.js process, replacing legacy `skipDeployment` handling
      with explicit `@force-gate !deploy` directives:
      
      - `graceful-shutdown-next-after/next-start` starts a fresh Next.js
      process, sends `SIGINT` and `SIGTERM`, and checks whether `after()`
      callbacks finish before it exits. Vercel manages the deployed process
      lifecycle; the deploy test runner cannot send those signals to that
      process or deterministically observe its shutdown. This does not imply
      that Vercel lacks graceful shutdown support.
      - `node-cli-args` invokes Node with `--experimental-network-inspection`
      and checks whether that invocation starts successfully on the current
      Node version. Deploy mode does not execute the test's local
      `startCommand`, so it cannot exercise Node's handling of that CLI flag.
      
      Preserve all test bodies, including the different development/production
      shutdown expectations and the Node 20 rejection case.
      
      Based on #98994, with #98911 above this PR.
      
      ## Verification
      
      - The shutdown assertions passed in webpack development and production
      modes (both signals in each mode).
      - The Node CLI test passed in both modes with normal isolated
      installation on Node 26.10.0. An initial `NEXT_SKIP_ISOLATE=1` run could
      not resolve its required fixture-local `node_modules/next`; using the
      normal fixture installation resolved that validation setup issue.
      - Collection with the real gate runtime and fixture setup stubbed
      confirmed all three assertions enabled in dev/start and all three
      skipped in deploy. A syntax-tree comparison confirmed the test
      definitions and assertions are unchanged.
      - Formatting and ESLint passed. All 24 gate-transform tests passed on
      the same base.
      - The JavaScript workspace build passed. Full bootstrap remains blocked
      in the native Rust step (`cargo metadata failed to run`). Deploy
      execution was not run; local collection verifies the exclusions without
      deployment.
      
      <!-- NEXT_JS_LLM -->
      84dd9be7
    • Jamiboy Mohammad's avatar
      Enable nullish config tests in deploy mode (#99397) · 788e6a7a
      Jamiboy Mohammad authored
      ## Summary
      
      Enable the nullish-config e2e suite in deploy mode by giving the `null`
      and `undefined` cases separate checked-in JavaScript configs and test
      instances, sharing the existing page fixture. This removes runtime file
      mutation and manual server restarts while preserving the rendering and
      startup/build-log assertions.
      
      ## Verification
      
      - Both cases passed in dev and production with Turbopack and Webpack.
      - Formatting and ESLint passed.
      - Deploy-mode execution has not been run locally; the PR enables the
      suite for deploy CI.
      
      <!-- NEXT_JS_LLM -->
      788e6a7a
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.53 · b1fa1213
      next-js-bot[bot] authored
      b1fa1213
    • Jan Kassens's avatar
      [create-next-app] Enable Cache Components by default in create-next-app (#99436) · 61fb9359
      Jan Kassens authored
      Updates the default of `create-next-app` to enable Cache Components.
      This makes sure new apps have an easier transition. Also updates
      documentation.
      
      Closes NAR-928
      61fb9359
    • Josh Story's avatar
      Include async module evaluation in client loading metrics (#99427) · 40a91948
      Josh Story authored
      ## Summary
      
      Include async client-module evaluation in loading metrics. A module with
      top-level `await` can make `require()` return a Promise; measuring only
      until that return omits the subsequent evaluation wait. This follows
      #99322 and addresses [Hendrik’s
      review](https://github.com/vercel/next.js/pull/99322#discussion_r4132744744).
      
      Observe native Promise resolution and rejection while preserving the
      original return value and per-render attribution. Synchronous modules
      keep their existing behavior, including exports named `then` and thrown
      errors.
      
      ## Verification
      
      - End-to-end regression: a real Client Component waits five seconds
      during top-level `await`; an HTML request must report more than one
      second of accumulated loading time through the standard Performance API.
      The pre-fix code reported only 38 ms; the fixed code passes.
      - Replaced the PR-added mocked-loader tests. The existing eight logger
      tests remain unchanged and pass.
      - Full client-loading group: dev Webpack and production Turbopack, 6
      passed each. Types, lint, formatting, and the full build pass.
      
      <!-- NEXT_JS_LLM -->
      40a91948
    • Jimmy Miller's avatar
      turbo-tasks-backend: fix leaf distance tracing compilation (#99443) · 1e0b765e
      Jimmy Miller authored
      Initialize queued tracing spans and borrow them before entering. Fix
      compilation with trace_leaf_distance_update enabled.
      1e0b765e
    • Jamiboy Mohammad's avatar
      Enable proxy export tests in deploy mode (#99400) · ef4aa3db
      Jamiboy Mohammad authored
      ## Summary
      
      Enable deploy coverage for all six proxy export cases by checking in
      each `proxy.ts` variant and giving it an independent test instance with
      the shared app fixture. Valid exports retain their browser rendering
      assertions; invalid exports use rejected startup and retain the complete
      compiler diagnostics, replacing local file writes and repeated builds on
      one instance.
      
      ## Verification
      
      - All six cases pass in dev and production with Turbopack and Webpack.
      - Turbopack production was verified with normal fixture isolation; the
      local `NEXT_SKIP_ISOLATE=1` run reports a different diagnostic path.
      - Formatting and ESLint passed.
      - Deploy execution has not been run locally; this PR enables all six
      cases for deploy CI.
      
      <!-- NEXT_JS_LLM -->
      ef4aa3db
    • Aurora Scharff's avatar
      docs: record API stabilization across Next.js 16 releases (#99420) · 96a33793
      Aurora Scharff authored
      ## Summary
      
      Fill gaps in API reference history so readers can tell which Next.js 16
      release stabilized an API or renamed its experimental form.
      
      - **16.0.0:** Record stabilization of `cacheLife()`, `cacheTag()`, `use
      cache`, the caching configuration options, React Compiler support, and
      Turbopack production builds. Add the missing `enablePrerenderSourceMaps`
      reference, shared with the Pages Router, documenting its current default
      and promotion out of `experimental`.
      - **16.2.0:** Record the promotion of `adapterPath` to a stable,
      top-level option.
      - **16.3.0:** Replace the `v16.x.x` placeholders for the `instant` and
      `prefetch` route exports with their stabilization version and previous
      names.
      - **16.4.0:** Clarify that the new `prefetch()` and `navigation()`
      functions replace names used in earlier canaries.
      
      The `catchError` and `retry` histories already correctly record
      introduction in 16.2.0 and stabilization in 16.3.0, so they are
      unchanged.
      
      ## Verification
      
      - Checked the 16.0 release and upgrade guides, PR #84877, and the
      configuration definitions/migrations in the v15.5.0 and v16.0.0 tags.
      - Checked the route exports against the v16.2.0/v16.3.0 source and
      stabilization commits #94578 and #94571; checked the function renames
      against #99241.
      - Checked the new source-map reference against the current config
      default and prerender worker implementation.
      - Prettier and diff checks passed. Documentation only; no runtime code
      changed.
      
      <!-- NEXT_JS_LLM -->
      96a33793