1. 01 Oct, 2026 25 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.56 · a209429a
      next-js-bot[bot] authored
      a209429a
    • Jiwon Choi's avatar
      Measure AI upgrade nudges, handoffs, and completion (#99465) · c1fe35e4
      Jiwon Choi authored
      > [!TIP]
      > Recommended to review commit by commit with "Hide whitespace" enabled.
      
      ### Why?
      
      Measure how often humans and agents receive upgrade nudges, start AI
      upgrades, and finish them.
      
      ### How?
      
      Record the configured policy, shown nudges, human decisions, AI upgrade
      runs, CLI results, and agent results through existing Next.js telemetry.
      Existing telemetry opt-out settings apply.
      
      `next upgrade --ai` prepares an upgrade prompt and hands it to an agent.
      The prompt asks the agent to run `next internal report-ai-upgrade
      <run-id> success|failure` after completing the upgrade and verification.
      The run ID links this report to the original upgrade run.
      
      Completion reporting depends on the agent following that instruction. A
      missing report means unknown, not failure. The prompt does not instruct
      the agent to hide reporting or require it to mention the telemetry
      submission to the user. The reporting command suppresses the normal
      telemetry notice.
      
      Closes NAR-938
      c1fe35e4
    • Luke Sandberg's avatar
      turbo-persistence: 32 bit fingerprints for the used keys AMQFs (#99333) · a9c23750
      Luke Sandberg authored
      ## What
      
      decrease the size of the used key amqfs to 32 bits
      
      ## Why
      Save disk space, compaction will also be a bit faster due to smaller
      filters which are cheaper to query and merge.
      
      All filters keep the same fingerprint size, so their union still uses
      qfilter's sorted merge.
      
      ## Verification
      
      - Re-encoding the used keys AMQFs of the final cache of a 31-build
      vercel-site run (GC on): **61.8 MB → 17.8 MB** (7.96 → 2.29 bytes per
      key), about 1.5% of the 2.96 GB cache. GC off: 58.9 → 16.9 MB.
      - `cargo test -p turbo-persistence` and `cargo test -p
      turbo-tasks-backend --tests` pass.
      
      <!-- NEXT_JS_LLM -->
      a9c23750
    • Jimmy Miller's avatar
      Remove suspend during operations (#99383) · eaa2f075
      Jimmy Miller authored
      ## What
      
      Remove the ability to suspend in flight operations to allow for
      snapshotting and GC
      
      ## Why
      
      Exstensive testing with GC has revealed a number of bugs latent in this
      system
      
      * transient task ids are getting serialized as part of operations, this
      confuses our new stricter task access semantics in fresh sessions
      * child execution contexts don't properly participate, they both need to
      suspend when requested to avoid exceeding retries since the task they
      are waiting for has already suspended, and cannot suspend because that
      could deadlock the scope_bounded call
      
      Instead we just don't suspend. This simplifies a lot, should be a small
      perf win (purely from not touching the atomics as often)
      
      The major risk is that waiting for everything to settle adds latency. To
      mitigate that:
      
      * idle snapshots don't wait for operations to settle, they just bail out
      instead
      * other snapshots do wait but log warnings if it takes more than 10s,
      this should never happen but if it does we will have a smoking gun
      
      ---------
      Co-authored-by: 's avatarLuke Sandberg <lukesandberg@users.noreply.github.com>
      eaa2f075
    • Josh Story's avatar
      test: migrate runtime deploy exclusions to force gates (#98159) · c62c51e3
      Josh Story authored
      ## Summary
      
      Migrate the remaining runtime, middleware, instrumentation, telemetry,
      logging, and local-process deployment exclusions to `@force-gate` and
      remove their `skipDeployment`/`skipped` control flow. This stack is
      rooted at canary and independent of #98430; it preserves deployment
      coverage already enabled on canary.
      
      The sub-shell-generation-middleware migration is deferred to #98155
      while its adapter deployment cache-upgrade failure is investigated. Its
      test file stays byte-for-byte identical to this PR's base, preserving
      the existing adapter exception and assertions.
      
      Adds the static nodeMiddleware condition and its unit coverage. The
      custom-server and OpenTelemetry files covered by #98994 are omitted.
      
      ## Verification
      
      - Compared test registration against canary in development, production,
      and deploy modes with test bodies and hooks disabled (Webpack). Existing
      active deployment assertions are preserved; development/production test
      selection is unchanged apart from replacing empty skip placeholders with
      skipped real tests.
      - Gate unit tests: 79 passed.
      - TypeScript, Prettier, and ESLint checks passed. Registration probes
      use a default config for lazy predicates and do not exercise fixture
      setup or test bodies.
      - Verified the deferred suite is absent from this PR diff and the
      upper-layer patches are unchanged. Full bootstrap passed on the combined
      canary-based stack after the final restack; deployment execution remains
      for CI.
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      Co-authored-by: 's avatarJamiboy Mohammad <jamiboym@gmail.com>
      c62c51e3
    • Josh Story's avatar
      test: migrate asset deploy exclusions to force gates (#98158) · 8af1fab7
      Josh Story authored
      ## Summary
      
      Migrate the remaining image, font, CSS, and other asset integration
      deployment exclusions to `@force-gate` and remove their
      `skipDeployment`/`skipped` control flow. This stack is rooted at canary
      and independent of #98430; it preserves deployment coverage already
      enabled on canary.
      
      Shared image-optimizer exclusions are placed on the calling test suites
      because gate pragmas are transformed only in test files. Existing
      bundler guards in the shared helper are preserved.
      
      ## Verification
      
      - Compared test registration against canary in development, production,
      and deploy modes with test bodies and hooks disabled. Existing active
      deployment assertions are preserved; development/production test
      selection is unchanged apart from replacing empty skip placeholders with
      skipped real tests. Checked both Webpack and Turbopack.
      - TypeScript, Prettier, and ESLint checks passed. Registration probes
      use a default config for lazy predicates and do not exercise fixture
      setup or test bodies.
      - Full bootstrap attempted, but the local native SWC build fails at
      `cargo metadata` with `EPERM`; full integration/deployment execution
      remains for CI.
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      Co-authored-by: 's avatarJamiboy Mohammad <jamiboym@gmail.com>
      8af1fab7
    • Josh Story's avatar
      test: migrate Pages Router deploy exclusions to force gates (#98157) · 3ca20b5a
      Josh Story authored
      ## Summary
      
      Migrate the remaining Pages Router, API route, i18n, custom route,
      rewrite, redirect, and error-page deployment exclusions to `@force-gate`
      and remove their `skipDeployment`/`skipped` control flow. This stack is
      rooted at canary and independent of #98430; it preserves deployment
      coverage already enabled on canary.
      
      The custom-app-render and client-max-body-size files covered by #98994
      and #98911 are omitted.
      
      ## Verification
      
      - Compared test registration against canary in development, production,
      and deploy modes with test bodies and hooks disabled (Webpack). Existing
      active deployment assertions are preserved; development/production test
      selection is unchanged apart from replacing empty skip placeholders with
      skipped real tests.
      - TypeScript, Prettier, and ESLint checks passed. Registration probes
      use a default config for lazy predicates and do not exercise fixture
      setup or test bodies.
      - Full bootstrap attempted, but the local native SWC build fails at
      `cargo metadata` with `EPERM`; full integration/deployment execution
      remains for CI.
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      Co-authored-by: 's avatarJamiboy Mohammad <jamiboym@gmail.com>
      3ca20b5a
    • Janka Uryga's avatar
      fix: stale usages of unstable_ensureStatic (#99540) · 4f392ad7
      Janka Uryga authored
      #97393 was a stale merge. we've renamed `unstable_ensureStatic` to
      `ensureStatic` in the meantime.
      4f392ad7
    • Josh Story's avatar
      Add unstable parameter matching APIs (#97393) · d5d747e9
      Josh Story authored
      ## Summary
      
      Let Cache Components applications configure parameter matching
      separately from build-time prerenders. `generateStaticParams` continues
      to supply concrete examples; the new `unstable_paramMatching` and
      `unstable_generateParamMatching` exports control whether a novel value
      returns 404, blocks on generation, receives a fallback shell, or stays
      dynamic.
      
      With `cacheComponents: true`:
      
      ```ts
      // app/[lang]/layout.tsx
      export const unstable_paramMatching = { lang: 'not-found' }
      
      // app/[lang]/catalog/[top]/items/[bottom]/page.tsx
      export const unstable_paramMatching = {
        top: 'blocking',
        bottom: 'fallback',
      }
      
      export function generateStaticParams() {
        return [{ lang: 'en', top: 't1', bottom: 'b1' }]
      }
      ```
      
      This prerenders `/en/catalog/t1/items/b1`. A language other than `en`
      returns 404. On a cache miss, `/en/catalog/t2/items/b2` blocks on
      generation, while `/en/catalog/t1/items/b2` can receive fallback UI
      immediately. `dynamic` keeps a parameter out of prerenders.
      
      Alternatively, `export async function unstable_generateParamMatching()`
      returns the same partial object. It takes no arguments and runs
      independently of `generateStaticParams`, once per module within each
      route evaluation. Public `use cache` helpers are supported. No
      additional configuration flag is required, and `ParamMatching` from
      `next` provides optional strict typing.
      
      Policies merge from layouts toward pages, with descendants overriding
      only supplied keys:
      
      - A module can configure parameters at or above its segment. Explicit
      modes must follow URL order: `not-found → blocking → fallback →
      dynamic`.
      - A `not-found` parameter requires every preceding parameter to be
      explicitly `not-found`, too. Every route or parallel branch sharing that
      parameter definition must agree.
      - Unconfigured parameters retain inference. An unconfigured tail without
      examples stays dynamic; explicitly dynamic parameters cannot be included
      in prerenders.
      - Shell validation follows explicit fallback boundaries instead of
      silently replacing them with blocking behavior; `instant = false` opts
      out of that validation. With these APIs, `output: 'export'` requires all
      parameters to be explicitly `not-found`.
      - `unstable_ensureStatic = 'navigation'` allows `blocking` and
      `not-found`, but rejects effective `fallback` and `dynamic` policies in
      both builds and development. It still requires complete
      `generateStaticParams` examples and fully static server output, even
      with `instant = false`. Supporting fallbacks for fully static
      navigations is deferred to a follow-up.
      
      Runtime admission, cache regeneration, and client route discovery
      preserve those boundaries. Adapter output uses the existing routing
      contract, including prefixed query keys for root fallbacks.
      
      ## Verification
      
      - Unit and integration coverage for policy merging, validation,
      generated types, shell selection, blocking/fallback behavior,
      navigation, parameter encoding, revalidation, and root-cache isolation.
      - Real fixtures cover direct, inherited, generated, and parallel-slot
      combinations with `ensureStatic`, including valid overrides, missing
      examples, dynamic-data errors, and preserved closed prefixes. Both
      bundlers and both Partial Prefetching settings are covered in
      build/start and dev.
      - Existing `ensure-static-navigation` build/dev validation and
      `ensure-static-navigation-runtime` production suites pass without
      changing their fixtures or validation implementation.
      - Routing, generator, and root-parameter fixtures have passed real
      adapter deployment tests in both ordinary and Cache Components jobs.
      Local adapter-output assertions separately check the root-fallback query
      contract.
      - [ ] Confirm cold open-suffix requests and revalidation in a deployment
      known to use grouped functions, and verify rejected prefixes do not
      invoke a function or consult ISR. Passing HTTP assertions alone does not
      establish these properties.
      
      <!-- NEXT_JS_LLM -->
      d5d747e9
    • Swarnava Sengupta's avatar
      docs: point next package security disclosure to HackerOne (#99459) · d9831527
      Swarnava Sengupta authored
      Updates the Security section in packages/next/README.md to send bug
      bounty reports to [Vercel’s HackerOne
      program](https://hackerone.com/vercel) instead of the deprecated email
      address.
      
      Expires: 2026-09-30
      d9831527
    • Aurora Scharff's avatar
      docs: add ensureStatic reference and validation guidance (#99355) · a1ad443e
      Aurora Scharff authored
      ## Summary
      
      - document the `ensureStatic` route segment config for Next.js 16.4,
      including the `shell`, `prefetch`, and `navigation` levels, their
      prerequisites, and how requirements compose across pages, layouts, and
      parallel routes
      - add the validation experience for `ensureStatic = 'navigation'`,
      including direct Learn more links, route, metadata, and viewport
      guidance, cause-oriented fix cards, and build diagnostics
      - add focused coverage for route content, metadata, viewport, cache
      lifetimes, server promises, and dynamic parameters
      
      This PR documents the final public `ensureStatic` name. The framework
      export change lands separately.
      
      Short-lived cache failures use the normal runtime-data or uncached-data
      message selected by the existing validator. They do not have a separate
      cache-lifetime classifier.
      
      ## Design and capture review
      
      - Route: [runtime
      data](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/125-ensure-static-cookies),
      [uncached
      data](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/128-ensure-static-uncached),
      [connection](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/129-ensure-static-connection)
      - Metadata: [runtime
      data](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/130-ensure-static-metadata-runtime),
      [uncached
      data](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/131-ensure-static-metadata-dynamic)
      - Viewport: [runtime
      data](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/132-ensure-static-viewport-runtime),
      [uncached
      data](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/133-ensure-static-viewport-dynamic)
      - Cache lifetimes: [short
      expire](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/134-ensure-static-short-expire),
      [short
      stale](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/135-ensure-static-short-stale),
      [`revalidate:
      0`](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/136-ensure-static-zero-revalidate)
      - Other validation: [`instant =
      false`](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/137-ensure-static-instant-false),
      [Suspense](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/138-ensure-static-suspense),
      [server
      promise](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/139-ensure-static-client-promise),
      [missing
      parameters](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/144-ensure-static-missing-params)
      
      ## Verification
      
      - `pnpm --filter=next build`
      - Development E2E: 27 tests and 19 snapshots passed
      - Production E2E: 27 tests and 20 snapshots passed
      - Focused overlay message and fix-card unit suites: 137 tests passed
      - Error-overhaul production build: 124 routes generated
      - Captured build output for 22 Ensure Static scenarios and dev overlays
      for all applicable insight cases
      - Prettier, ESLint, and `git diff --check` passed for the changed
      framework files
      - Documentation link validation passed
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      Co-authored-by: 's avatarJoseph Chamochumbi <joseph.chamochumbi@vercel.com>
      a1ad443e
    • Tobias Koppers's avatar
      Enable Turbopack export name mangling by default for builds (#99362) · e4ceb139
      Tobias Koppers authored
      ### What?
      
      `experimental.turbopackMangleExportNames` is now on by default for
      production builds (`next build`) in both stable and canary releases. It
      stays off by default in development (`next dev`), and an explicit
      `true`/`false` in `next.config` still wins in either mode.
      
      ### Why?
      
      Mangling export names shortens the keys modules use to link to each
      other, which reduces bundle size. Until now it was only on by default in
      canary builds, because stable releases pinned it to `false`.
      
      ### How?
      
      Turbopack already chooses the default from the build mode in
      `NextConfig::turbopack_mangle_export_names`: if the option is unset,
      it's enabled everywhere except development, and an explicit value
      overrides that. The only thing keeping it off on stable was the JS
      default config, which forced `false` when `isStableBuild()` was true.
      That pin is removed, so the default stays unset on every release channel
      and the Rust side decides from the build mode. There's no change to Rust
      or to the mangling itself.
      
      The JSDoc on the config type and the Turbopack config docs table now say
      the default is `false` in dev and `true` for builds.
      
      ### Verification
      
      - Prettier and ESLint pass on the changed files.
      - `pnpm --filter=next types`: only 3 `TS2307` errors, all for missing
      generated `dist` modules (`@next/font`, `@vercel/og`) in an
      unbootstrapped checkout. The same errors show up without this change,
      and none are in `config-shared.ts`.
      - Not run: a bootstrapped integration build. CI covers the build-mode
      behavior end to end.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet dfbd6860-64e0-4a98-ac6f-220e8131fee2 -->
      
      ---------
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
      e4ceb139
    • Jiwon Choi's avatar
      Allow skipping React and ESLint upgrades (#99468) · a3526b8e
      Jiwon Choi authored
      Stacked on #99471.
      
      ### Why?
      
      Upgrading React or ESLint can cause peer dependency conflicts. After
      restoring compatible versions, retrying the upgrade can bump them again.
      
      ### How?
      
      Add `--skip-react-upgrade` and `--skip-eslint-upgrade` to skip the
      corresponding dependency updates and codemods. The React flag also
      preserves types and overrides.
      
      Add troubleshooting checklists to the version guides and point upgrade
      agents to them. Required migrations still need to be completed before
      verification; if Next.js already matches the target, run the interrupted
      migrations individually.
      a3526b8e
    • Jiwon Choi's avatar
      Prefer the declared package manager during upgrades (#99471) · 7bc06f4a
      Jiwon Choi authored
      ### Why?
      
      Running a codemod through `npx` can select npm even when the app
      declares Yarn, pnpm, or Bun, causing dependency installation to fail.
      
      ### How?
      
      Read `package.json#packageManager` before `npm_config_user_agent`. Keep
      the existing user-agent, lockfile, and npm fallbacks unchanged.
      
      Add shared checks for installation and recovery after an interrupted
      upgrade.
      7bc06f4a
    • Will Binns-Smith's avatar
      Use Next.js conventions in bundle analyzer UI (#98780) · f260d466
      Will Binns-Smith authored
      Use the App Router error boundary and `next-themes` provider instead of
      custom client-side equivalents.
      
      Persist environment, file type, and debounced file search filters in URL
      search parameters so analyzer views can be shared. Remove the
      incompatible `next start` script from the statically exported app.
      
      ## What?
      
      - Add an App Router `error.tsx` boundary with segment reset support
      - Replace the inline theme bootstrap script with `next-themes`
      - Store analyzer filters and file search in URL search parameters
      - Remove the static export's `next start` script
      
      ## Why?
      
      Use the framework's existing error, theme, and navigation integration
      while keeping the analyzer's static export deployment model.
      
      ## How was it tested?
      
      - `pnpm --filter=@next/bundle-analyzer-ui exec tsc --noEmit`
      - `pnpm --filter=@next/bundle-analyzer-ui lint`
      - `pnpm --filter=@next/bundle-analyzer-ui build`
      
      <!-- NEXT_JS_LLM -->
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarWill Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
      f260d466
    • Josh Story's avatar
      Pass App Page HMR state through a dev render context (#99487) · ec4225cd
      Josh Story authored
      ## Summary
      
      Continue decoupling App Router rendering from incoming request objects
      by capturing HMR state at the handler boundary and passing it through
      DevRenderContext.
      
      The context contains the HMR refresh hash and shared server-component
      HMR cache, and is constructed only under `next dev`. Production omits
      this state, and prerendering does not consume it. Rendering no longer
      reads the hash from request metadata. Existing upstream metadata
      transport and cache invalidation behavior are preserved; status and
      debugging callbacks are left for separate migrations.
      
      ## Verification
      
      - `pnpm test-dev-turbo
      test/development/app-dir/use-cache-dev/use-cache-dev.test.ts` (7 tests)
      - `pnpm test-dev-webpack
      test/development/app-dir/use-cache-dev/use-cache-dev.test.ts` (7 tests)
      - `pnpm test-start-webpack test/e2e/app-dir/app/standalone.test.ts`
      (isolated production build and Edge coverage)
      
      <!-- NEXT_JS_LLM -->
      ec4225cd
    • Josh Story's avatar
      Remove request forwarding from App Router error reporting (#99488) · 59715b7b
      Josh Story authored
      ## Summary
      
      Continue decoupling App Router rendering from incoming request objects
      by keeping the request inside handler-owned instrumentation callbacks.
      Renderers now report the error and its context without forwarding the
      request. The public onRequestError request descriptor and error-handling
      behavior are unchanged.
      
      Remove unused callback plumbing and extend the existing Node and Edge
      instrumentation coverage to check query strings and custom headers.
      
      ## Verification
      
      - Existing server-action instrumentation tests passed in development and
      production with both Turbopack and Webpack.
      - `pnpm test-start-turbo test/e2e/on-request-error/isr/isr.test.ts`
      - `pnpm test-start-webpack test/e2e/app-dir/app/standalone.test.ts`
      (isolated Edge build)
      
      <!-- NEXT_JS_LLM -->
      59715b7b
    • Niklas Mischkulnig's avatar
      docs: self hosting immutable static assets (#97008) · 4854b4e8
      Niklas Mischkulnig 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
      
      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 #
      
      -->
      4854b4e8
    • Jamiboy Mohammad's avatar
      test: enable deployment fixtures with Corepack and portable tarballs (#99192) · 60cb5b3e
      Jamiboy Mohammad authored
      ## Summary
      
      Enable deployment coverage for seven fixture suites while preserving
      dependency declarations, test bodies, assertions, and unrelated mode
      restrictions.
      
      - Set `ENABLE_EXPERIMENTAL_COREPACK: '1'` for `geist-font`,
      `gssp-redirect`, `rewrite-with-browser-history`,
      `router-hash-navigation`, and `scroll-back-restoration` so Vercel
      installs with the pnpm version declared by the generated
      `packageManager` field. These fixtures do not require committed pnpm
      lockfiles or `npm_config_frozen_lockfile` overrides.
      - Use fixture-relative tarball dependencies for `self-importing-package`
      and `typeof-window` so deployment installation does not refer to paths
      on the GitHub Actions runner.
      - Apply the Corepack setting to both suites using the shared source-map
      fixture. Retain their deployment exclusions because their assertions
      require runtime logs or a local Node.js inspector; they are not counted
      as deployment passes.
      
      ## Verification
      
      Ran focused `pnpm test-deploy-turbo --runTestsByPath` tests with
      `VERCEL_TURBOPACK_TEST_TEAM=vtest314-next-e2e-tests`,
      `NEXT_E2E_TEST_TIMEOUT=240000`, and `NEXT_TEST_VERSION=canary` (resolved
      to `16.4.0-canary.53`):
      
      - All five affected deploy-enabled suites passed in normal mode: **26/26
      tests**.
      - With `__NEXT_CACHE_COMPONENTS=true` and
      `__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true`, the same five suites
      passed: **26/26 tests**. Remote build logs confirmed both features were
      enabled.
      - All ten deployments detected the Corepack flag and `pnpm@10.33.0`,
      installed successfully without source lockfiles, and executed the
      browser/HTTP assertions.
      - The unchanged `self-importing-package` and `typeof-window` tarball
      fixtures passed in both modes in the preceding validation (two tests per
      mode); this update does not touch them.
      - Prettier, ESLint, and `git diff --check` passed. The Next.js watch
      build completed with zero type errors. The full pre-push build completed
      17/18 tasks; native SWC remains blocked because Cargo is unavailable
      locally.
      
      These focused runs validate the fixture changes against published
      canary, not all CI checks on the updated PR head.
      
      <!-- NEXT_JS_LLM -->
      60cb5b3e
    • 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 15 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