1. 24 Sep, 2026 7 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.43 · 5a46fc6c
      next-js-bot[bot] authored
      5a46fc6c
    • Tobias Koppers's avatar
      Tune Node server chunking for require overhead (#99120) · 76117ccd
      Tobias Koppers authored
      ### What?
      
      Tune production Node.js server JavaScript chunking to use a lower
      estimated cost for loading a chunk, a smaller soft minimum chunk size,
      and no per-group chunk-count target. Client, CSS, Edge, and development
      chunking remain unchanged.
      
      ### Why?
      
      Server chunks are loaded with Node.js `require()`, not network requests.
      Measurements across synthetic JavaScript chunks found roughly 0.1 ms of
      fixed load overhead, equivalent to approximately 2.5–25 KB of parsing
      work depending on code density. The existing 200 KB estimate overweights
      each server-side load and encourages unnecessary merging.
      
      ### How?
      
      Apply the server-specific tuning to both Node production chunking
      contexts while keeping the existing maximum merge size. The values are
      an initial estimate from the benchmark; representative application
      builds and cold-start measurements can refine them.
      
      ### Verification
      
      - `cargo fmt --manifest-path crates/next-core/Cargo.toml -- --check` —
      passed.
      - `git diff --check` and checks of both Node contexts and unchanged Edge
      values — passed.
      - `cargo check -p next-core --offline` — blocked before compilation by
      an uncached `bgw/bincode` Git dependency.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 8b0bc78c-72fb-424d-a85e-c5a5b87ff5f4 -->
      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>
      76117ccd
    • Niklas Mischkulnig's avatar
      5ca62ef4
    • Jamiboy Mohammad's avatar
      test: enable deploy coverage for TypeScript config errors (#98849) · e7184817
      Jamiboy Mohammad authored
      ## Summary
      Enable deployment coverage for six TypeScript configuration-error tests
      using the deferred deployment lifecycle from #98776. Assert a failed
      build/deployment and the specific type error instead of using local-only
      build APIs. Explicitly enable the native TypeScript loader in the two
      next.config.ts fixtures that rely on top-level await, so they reach
      their intended type-checking error.
      
      ## Verification
      - All six fixtures passed Turbopack production/development and Webpack
      production checks after the native-loader fixture correction.
      - Local checks used the published native binding. Exact native and
      deploy validation are pending repository CI.
      
      <!-- NEXT_JS_LLM -->
      e7184817
    • Jamiboy Mohammad's avatar
      test: enable deploy coverage for routing build errors (#98848) · 6c2e502a
      Jamiboy Mohammad authored
      ## Summary
      Enable deployment coverage for 11 routing and validation exclusion
      locations on top of #98776. Replace local-only build calls with explicit
      start/failure assertions while preserving each expected diagnostic and
      development behavior. The edge re-export test continues to accept a
      successful Webpack build with warnings; Turbopack must fail.
      
      ## Verification
      - Focused Turbopack production/development checks passed.
      - Webpack production checks passed after correcting the edge re-export
      expectation.
      - Local checks used the published native binding. Exact native and
      deploy validation are pending repository CI.
      
      <!-- NEXT_JS_LLM -->
      6c2e502a
    • Jamiboy Mohammad's avatar
      test: enable deploy coverage for cache build errors (#98847) · 4862c38b
      Jamiboy Mohammad authored
      ## Summary
      Enable deployment coverage for 13 cache/prerender exclusion locations
      across 11 test files, using the deferred deployment lifecycle from
      #98776. Tests explicitly start the build/deployment, assert its failure,
      and retain the original diagnostics. Remove the corresponding deploy
      gates and explanatory TODOs, and allow four minutes for tests that
      perform a deployment in their bodies.
      
      ## Verification
      - Focused Turbopack production and development checks passed. Two
      timing-sensitive development suites passed on recheck after comparing
      with the unchanged base.
      - All applicable Webpack production checks passed; existing bundler
      exclusions are preserved.
      - Local checks used the published native binding. Exact native and
      deploy validation are pending repository CI.
      
      <!-- NEXT_JS_LLM -->
      4862c38b
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.42 · b71c9480
      next-js-bot[bot] authored
      b71c9480
  2. 23 Sep, 2026 33 commits
    • Sebastian "Sebbie" Silbermann's avatar
      [ci] Skip preview tarball upload when the artifact is missing (#98713) · 2f979628
      Sebastian "Sebbie" Silbermann authored
      The build-and-deploy workflow can conclude successfully without
      producing a `preview-tarballs` artifact, for example when its
      `deploy-tarball` job is skipped on docs-only canary pushes or on
      production tag pushes
      (https://github.com/vercel/next.js/actions/runs/35075211933). The
      `upload-preview-tarballs` workflow then failed when downloading the
      artifact.
      
      This change lets the download step fail without failing the job and
      skips the upload step in that case, so a missing artifact no longer
      turns the workflow red. The failed-but-tolerated download step still
      leaves an error annotation on the green run. Real breakage still
      surfaces in build-and-test, which waits on the published tarballs.
      2f979628
    • Sebastian "Sebbie" Silbermann's avatar
      [cd] Retry preview tarball uploads with backoff and richer diagnostics (#99060) · 27a39ba1
      Sebastian "Sebbie" Silbermann authored
      The `upload-preview-tarballs` workflow aborted its entire run when a
      single tarball upload hit a transient network error, and the logged
      error did not identify which package or request had failed. One observed
      run failed with `TypeError: fetch failed` (`UND_ERR_SOCKET`) after the
      ~78MB `next` tarball body had been written but before the response
      arrived (e.g.
      https://github.com/vercel/next.js/actions/runs/35721116824/job/106724007428#step:4:19).
      
      `scripts/upload-preview-tarballs.js` now wraps each package's upload in
      a retry with exponential backoff (5 attempts, 1s/2s/4s/8s). Every
      failure is retried, including network-level rejections without an HTTP
      status. Error messages now name the package and the failed request
      phase, and non-OK responses include a truncated response body alongside
      the status and response headers such as `x-vercel-id`, so the next rare
      failure is actionable. A package that exhausts its retries no longer
      aborts the remaining uploads; all failures are collected and reported at
      the end as an `AggregateError`.
      Co-authored-by: 's avatarClaude Code (kimi-k3[1m]) <noreply@anthropic.com>
      27a39ba1
    • Will Binns-Smith's avatar
      Promote next analyze command (#99074) · 3950aff8
      Will Binns-Smith authored
      ### What?
      
      Promote the Turbopack bundle analyzer to `next analyze` and its
      build-time option to `next build --analyze`. Update CLI help, docs, and
      analyzer UI guidance to use those names, and remove the guide's
      experimental label. Keep both experimental spellings available for
      existing scripts.
      
      ### Why?
      
      Users should be able to discover and use the concise analyzer names
      without breaking workflows that already rely on the experimental command
      or build flag.
      
      ### How?
      
      The standalone analyzer uses a Commander command alias, so both command
      names share one implementation and option set. The build flag uses a
      hidden compatibility option, with both spellings driving the same
      Turbopack-only build analysis path. The existing analyzer e2e tests
      exercise the primary command.
      
      <!-- NEXT_JS_LLM -->
      
      <!-- fleet b2dc2832-cda3-4277-8570-6782a3a67c6e -->
      
      ---------
      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>
      3950aff8
    • Jiwon Choi's avatar
      [ai-upgrade] Remind the agent to report the nudge (#99127) · 41efc183
      Jiwon Choi authored
      ### Why?
      
      Coding agents can retry startup successfully and omit the upgrade
      reminder from their final response. That leaves users unaware of a
      security, latest-version, or Future Defaults recommendation.
      
      ### How?
      
      Tell agents to include the applicable upgrade recommendation when they
      report back, even if the retry succeeds. Assert this wording for all
      three reminder paths.
      
      Local focused Jest verification could not initialize because this
      worktree lacks the dependency setup required by the main checkout's
      compiled Next.js output.
      
      <!-- NEXT_JS_LLM -->
      41efc183
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.41 · c9a2a711
      next-js-bot[bot] authored
      c9a2a711
    • Tobias Koppers's avatar
      Add experimental custom webpack support (#98862) · b12b46b6
      Tobias Koppers authored
      ### What?
      
      Add the experimental `customWebpack` configuration option so
      webpack-mode applications can use a project-installed webpack version
      instead of the version bundled with Next.js. Webpack is now an optional
      `^5.98.0` peer dependency, and the new option is documented with
      end-to-end coverage for webpack 5.98.0 and 5.111.0.
      
      ### Why?
      
      Next.js currently redirects webpack imports to its bundled
      implementation. This prevents applications from opting into newer
      compatible webpack releases or validating upgrades independently. The
      new option provides an explicit escape hatch while preserving the
      bundled implementation as the default.
      
      ### How?
      
      After configuration is resolved, webpack-mode startup redirects the
      existing webpack require-hook aliases to the package resolved from the
      application. The selection is propagated to webpack build workers
      through the existing local-webpack runtime switch. If the optional peer
      cannot be resolved, Next.js restores its bundled aliases and reports an
      actionable installation error.
      
      The implementation only activates for webpack, leaving Turbopack and
      Rspack unchanged. It also handles the resolver stack API exposed by
      external webpack versions. The test matrix verifies the selected
      compiler version, rendering in development and production, the
      build-worker path, missing-peer diagnostics, and bundled fallback
      behavior when the option is disabled.
      
      ### Verification
      
      - `pnpm test-dev-webpack
      test/e2e/app-dir/custom-webpack/custom-webpack.test.ts`
      - `pnpm test-start-webpack
      test/e2e/app-dir/custom-webpack/custom-webpack.test.ts`
      - `pnpm --filter=next types`
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 19431696-5f4c-400d-a3be-700bfe86abda -->
      
      ---------
      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>
      b12b46b6
    • Jiwon Choi's avatar
      Default agentic upgrades to a separate worktree (#99111) · ccbd0cb5
      Jiwon Choi authored
      ### Why?
      
      The agent nudge offers a background upgrade without specifying a
      separate checkout, so upgrade edits can land alongside the current
      task’s changes.
      
      ### How?
      
      Make both the nudge and upgrade handoff instruct the agent to use a
      separate Git worktree unless the user explicitly requests otherwise. The
      handoff directs upgrade commands to the app’s corresponding directory in
      that worktree. Update the existing prompt assertions and snapshots to
      match.
      
      <!-- NEXT_JS_LLM -->
      ccbd0cb5
    • Jiwon Choi's avatar
      Improve agent upgrade failure message for missing app (#99117) · ae91b476
      Jiwon Choi authored
      ### Why?
      
      The missing-app error tells users to pass an app path without showing
      where it belongs in the command.
      
      ### How?
      
      Add `next upgrade [directory] --ai=<supplied value>` to the error,
      preserving the supplied AI upgrade type or bare `--ai` so users can
      retry with an explicit directory.
      
      <!-- NEXT_JS_LLM -->
      ae91b476
    • Hendrik Liebau's avatar
      Preserve error boundaries in on-demand partial prerenders (#99051) · f4a68604
      Hendrik Liebau authored
      An on-demand prerender failure still throws when its recovery output
      requires a resume. This hides the route's error boundary behind a
      generic error response, even when healthy parts of the page could
      continue rendering.
      
      Failures now retain their original error and serialized postponed state.
      Self-hosted servers append a separate continuation for each document
      request. Adapter deployments use the existing platform transport to
      resume with the actual request.
      
      In `next start`, a failed partial prerender follows the same prerender
      and resume flow as a successful PPR cache miss. Failed preludes are not
      persisted, so later independent requests retry prerendering before
      resuming. Concurrent requests can share the pending prerender, and each
      document request owns its resume.
      
      The response retains status 500 and non-cacheable headers. Failed output
      is not persisted as a successful ISR entry. Build failures and recovery
      without a usable Flight result continue to throw.
      
      The tests cover errors inside and outside Suspense, request-specific
      dynamic content, navigation after failed prefetches, same-URL recovery,
      successful-page retention, and original-error reporting.
      f4a68604
    • Hendrik Liebau's avatar
      Preserve error boundaries during on-demand prerendering (#99037) · c54cc098
      Hendrik Liebau authored
      In production, an error while generating an App Router page on demand
      can return a generic 500 response or a Pages Router 500 page instead of
      the route's `error.tsx` or `global-error.tsx`. This affects dynamic
      routes using `generateStaticParams`, even though their error boundaries
      work in development.
      
      A completed prerender failure now carries its error and recovery output
      through the renderer and response cache as an explicit result. The
      response cache retains completed failures within each platform
      invocation, without changing existing in-flight batching. Failed output
      is not persisted as a successful ISR entry. The server sends recovered
      documents with status 500 and non-cacheable headers. Failed RSC
      responses have empty bodies; navigation falls back to loading the
      document. Build failures and incomplete recovery continue to throw.
      Asynchronous error reporting runs in the background and uses the
      platform's `waitUntil` when available.
      
      Recovery that requires resuming a partially prerendered page is out of
      scope for this PR and continues to throw. A follow-up PR will preserve
      and resume that partial recovery output.
      
      The fix applies to self-hosted production servers and adapter-based
      Vercel deployments. The legacy Vercel deployment path retains its
      existing behavior of replacing the response with a generic error page.
      
      The tests cover both Cache Components settings, batched invocation
      failures, pending I/O inside Suspense, same-URL recovery,
      successful-page retention, and original-error reporting.
      
      Fixes #62046
      c54cc098
    • Tobias Koppers's avatar
      docs: clarify Turbopack ModulePart export examples (#99104) · f8ae35c2
      Tobias Koppers authored
      ## Summary
      
      Clarify the examples for `ModulePart::Export` and `ModulePart::Exports`
      so they illustrate the export declarations those parts represent, rather
      than the importing site or a single-export case.
      
      This follows two late review suggestions on the already-merged #96396:
      [named
      export](https://github.com/vercel/next.js/pull/96396#discussion_r4082789388)
      and [export
      declarations](https://github.com/vercel/next.js/pull/96396#discussion_r4082794496).
      No behavior changes.
      
      ## Verification
      
      - `cargo fmt --all -- --check` (from `turbopack/`)
      - `git diff --check`
      - Confirmed the diff changes only two Rust doc-comment lines.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 993ef5d6-cc80-4082-8e14-ff9ac871ce33 -->
      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>
      Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
      f8ae35c2
    • Luke Sandberg's avatar
      Add some more verification and safety rules around custom `distDir` (#98997) · 8fab0b4b
      Luke Sandberg authored
      ### What?
      next will delete some or all of the contents of `distDir` on start
      depending on mode. This is normally fine for the default `.next/` dir
      but for a user specified one it can be dangerous if it is misconfigured.
      
      Add some safety checks that the directory is in a valid location
      
      I explored enforcing that the specified directory was either empty,
      missing or filled only with files from a prior build/dev session, but
      this is very ambiguous and would add a speed bump to upgrade paths.
      
      re-compatibility: This PR is enforcing a constraint that wasn't
      previously enforced. In the error case we are addressing (setting dist
      dir to be the workspace root or appliction root), this is not considered
      breaking because all such uses would be catastrophic (application files
      deleted). The other enforcement is that the dist-dir is fully
      _contained_, this was always strictly enforced for turbopack but for
      webpack it would only fail later during dev-serving or SSG. So this is
      just making an obscure error more eager and consistent.
      
      Fixes #98958
      
      ---------
      Co-authored-by: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
      Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
      8fab0b4b
    • Josh Story's avatar
      Preserve closed-route admission across cache misses (#98964) · 851b6cb0
      Josh Story authored
      ## Summary
      
      Keep route admission independent of ISR cache contents. With Cache
      Components disabled, a route using `dynamicParams = false` and
      `generateStaticParams()` can currently return 200 for a build-generated
      URL, then incorrectly return 404 after `revalidatePath` expires its
      cache entry. An empty external cache causes the same failure on the
      first request.
      
      For example, if the build generated `/products/known`, that URL remains
      allowed after invalidation; `/products/unlisted` remains disallowed
      regardless of cache state. If a later build removes `/products/known`,
      it must immediately stop matching, even if an external cache still holds
      that URL's old response.
      
      The request handler now rejects unlisted closed URLs before looking up
      their ISR entries. This prevents both serving an old cache hit and
      generating a new response for a URL the current build does not admit. An
      admitted build path whose matched fallback is `false` regenerates using
      a blocking render when necessary.
      
      The two decisions stay separate: the manifest determines whether the URL
      may match, while the response generator chooses how to produce an
      admitted response. We do not share mutable fallback-mode state between
      those stages.
      
      ### Preserved exceptions and adapter behavior
      
      - **Server Actions:** forwarding can invoke a worker at
      `/products/[slug]`, not a concrete page URL. Action calls retain their
      existing exemption from page admission checks. A retained action must
      still work after the user navigates away from its closed route.
      - **Draft mode:** an unpublished URL can be previewed without admitting
      it publicly or replacing its public cache entry.
      - **Minimal mode:** the platform router remains responsible for
      admission before invoking the renderer.
      - **Adapters:** rendering a routing 404 now happens outside the response
      cache. The previous placement could successfully send a 404 and then
      throw `cache entry required but not generated` because it returned no
      cache entry for a non-null cache key. The new adapter fixture reproduces
      this on the parent runtime.
      
      This uses the existing prerender manifest and does not change its format
      or the adapter contract. The most specific matched dynamic route
      continues to determine the policy for open URLs, so specialized matchers
      can admit an open suffix without admitting an unknown closed prefix.
      
      ## Regression coverage
      
      Real fixtures cover:
      
      - Repeated invalidation, ordinary and optional catch-all paths,
      time-based ISR, concurrent regeneration, and serving a stale response
      while regenerating in the background.
      - Empty external caches and an external cache retained across two real
      builds. The latter verifies that the removed path's old entry still
      exists but is never consulted.
      - Document, HEAD, navigation, prefetch, bot, rewritten, and
      overlapping-route requests.
      - Direct and forwarded Server Actions, draft previews, and direct
      minimal-mode renderer invocations.
      - Adapter-specific 404 handling and regeneration of admitted paths.
      - The distinction between routing rejection and content that calls
      `notFound()`: an admitted URL can transition from 200 to 404 and back,
      including when its build render returned 404.
      
      These legacy `dynamicParams` fixtures are excluded from the Cache
      Components matrix because that configuration does not support the API.
      
      ## Stack
      
      This is an unflagged correctness fix, placed after #98950 and before the
      parameter-matching API in #97393. It can land without committing to that
      API. The API's mixed-prefix and dynamic-tail lifecycle coverage belongs
      in the API layer.
      
      ## Verification
      
      - Before the original fix, the two initial regression fixtures failed 11
      checks while the open-route and time-based controls passed.
      - Against the parent runtime, the new adapter fixture reproduces the
      cache-entry invariant on document, navigation, prefetch, and bot
      requests, plus the invalidation regression.
      - The retained Server Action regression passes on the parent runtime,
      fails on the earlier PR revision without the exemption, and passes with
      the explicit action exemption. It also passes in development with the
      exemption.
      - Local production runs before replaying the follow-up onto the rebased
      stack: all 49 tests across seven suites pass in both Webpack and
      fresh-native Turbopack, including the existing closed-parameter
      navigation suite. The follow-up patch applied unchanged; CI will verify
      the rebased head.
      - Development Turbopack request-mode coverage: 10 passed; the
      public-cache reuse assertion is production-only.
      - Repository TypeScript, Next.js declaration generation, changed-file
      formatting/ESLint, and `git diff --check` pass.
      
      No live deployment verification. A separate `revalidate-if-generated`
      hang with an always-empty custom cache reproduces on both this PR and
      its parent; its diagnostic is retained for a separate follow-up, not
      included or silently skipped here.
      
      <!-- NEXT_JS_LLM -->
      851b6cb0
    • Jimmy Miller's avatar
      Move suspension into operation guard (#99053) · 82dd6d6d
      Jimmy Miller authored
      So in some testing I found a rare error where a child task could take
      the suspend point, causing it to decrement the counter even though it
      hadn't incremented it. Move this operation to the guard makes this not
      impossible (you can still just grab the coordinator) but at least in
      this code path makes it unlikely you do this. It fixes the bug I found.
      Discussed this with Luke. We agreed trying to recreate the case in a
      unit test would probably be a bit overkill.
      82dd6d6d
    • Aurora Scharff's avatar
      [agent-feedback] Shorten managed agent instructions (#99065) · 0c129d01
      Aurora Scharff authored
      ## Summary
      
      - reduce the managed agent-feedback block from 199 to 160 words while
      restoring four scannable issue-category bullets
      - explicitly authorize the feedback pass without coupling it to
      `agentRules`
      - explain that `next dev` restores the managed block and that committing
      `AGENTS.md` keeps the tree clean
      - preserve the network-sandbox retry and tell agents to read the command
      output once without piping or truncating it
      - clarify that prepared reports remain in a browser URL fragment until
      the user submits them
      - keep the AI agents guide, API reference, focused integration coverage,
      and eval fixtures in sync
      - restore the `CLAUDE.md` compatibility import inside eval sandboxes
      only, without generating it for users
      - replace subjective feedback transcript judges with deterministic
      source and report-payload checks
      
      The existing `agentRules` managed block is unchanged.
      
      ## Eval results
      
      | Eval | Existing instructions | Shortened instructions |
      | --- | --- | --- |
      | Routine debugging | 10/10 passed in #98887 | Earlier runs produced no
      reports; a post-harness-fix rerun is pending |
      | Anonymization | 2/2 reporting checks passed in #98887 | The
      post-harness-fix rerun reached AI Gateway timeouts; deterministic schema
      and redaction checks are in place |
      | Distinct issues | 1/1 passed in #98887 | The post-harness-fix run
      produced two distinct valid reports; both deterministic report checks
      passed |
      
      The historical results come from #98887. The shortened-instruction runs
      use the same private `agent-feedback` treatment and are not published to
      nextjs.org/evals. The fixtures explicitly enable
      `experimental.agentFeedback`, matching the production opt-in.
      
      The previous transcript judges mixed feature behavior with subjective
      judgments about browser-opening attempts. The fixtures now check the
      actual product outcomes directly: routine work produces no report, a
      qualifying issue produces one valid anonymized report, and distinct
      issues produce separate valid reports.
      
      ## Verification
      
      - `pnpm testonly
      packages/next/src/server/lib/generate-agent-files.test.ts` (10/10
      passed)
      - `NEXT_SKIP_ISOLATE=1 HEADLESS=true pnpm test-dev-turbo
      test/development/app-dir/agent-rules-auto-generate/agent-rules-auto-generate.test.ts`
      (12/12 passed)
      - eval fixture dry-runs for `agent-057-agent-feedback-anonymization` and
      `agent-058-agent-feedback-distinct-issues`
      - targeted Prettier and ESLint through the pre-commit hook
      
      <!-- NEXT_JS_LLM -->
      0c129d01
    • Aurora Scharff's avatar
      docs: clarify Cache Components build output (#98274) · 12f85871
      Aurora Scharff authored
      ## Summary
      
      - Clarify that Cache Components uses PPR for every App Router page,
      including pages whose build-time HTML is empty.
      - Explain that the current tree-view symbols describe output rather than
      a different rendering model: an empty PPR HTML output can show `ƒ` at a
      fixed pathname or `◐` on a dynamic-path fallback row.
      - Clarify that Cache Components pages do not use `●`; generated paths
      from `generateStaticParams` show `○` or `◐` based on their HTML output.
      - Clarify that `instant = false` opts out of instant-navigation
      validation and, when it is the highest config, static-shell validation
      without changing the PPR rendering model.
      - Keep the guide's existing structure and examples while correcting
      factual wording about TypeScript checking, `generateStaticParams`,
      Partial Prefetching, cache lifetime output, and build debugging.
      - Remove signposting, filler, and unverified claims in the sections
      being corrected.
      
      ## Verification
      
      - `pnpm prettier --with-node-modules --ignore-path .prettierignore
      --check docs/01-app/02-guides/building.mdx`
      - `npx eslint --config eslint.config.mjs
      docs/01-app/02-guides/building.mdx`
      - `git diff --check`
      - Verified with `cacheComponents: true` that a fixed page covered by
      `instant = false` prints `ƒ`, writes 0-byte HTML, and remains
      `PARTIALLY_STATIC` in the prerender manifest. Removing the opt-out
      produces the expected prerender-blocking error.
      - Verified that a Cache Components route using `generateStaticParams`
      prints an unmarked route group, a `◐` fallback, and a `○` generated
      pathname without any `●` row.
      - Verified `instant = false` with synchronous runtime values and
      `--debug-prerender` source frames against a minimal Cache Components app
      using the local Next.js package and webpack.
      - Not run: `pnpm lint` (docs-only change; focused formatting, ESLint,
      and runtime checks passed).
      
      <!-- NEXT_JS_LLM -->
      12f85871
    • Tobias Koppers's avatar
      Update Rust namespace re-export snapshots (#99106) · 8ff7f2bd
      Tobias Koppers authored
      ### What?
      
      Update the generated JavaScript and source-map snapshots for the
      Turbopack namespace-value re-export named-import fixture.
      
      ### Why?
      
      Canary's Rust unit job fails because the checked-in fixture expects an
      obsolete export-registration sequence. The current generated output
      omits that redundant sequence, shifting the source-map mapping for the
      entry point.
      
      ### How?
      
      Regenerate both outputs together so the source map describes the
      JavaScript Turbopack actually emits. The fixture continues to exercise
      the named namespace imports and their referenced members; no runtime or
      generator behavior changes.
      
      ### Verification
      
      - Focused `turbopack-tests::snapshot` test passed twice in the default
      profile and once with CI's `release-with-assertions` profile.
      - Full Rust unit suite not run locally; PR CI will run it.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 141f2d4f-ccec-4c7c-a4ac-fd0bb00bdc73 -->
      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>
      8ff7f2bd
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.40 · c9b90452
      next-js-bot[bot] authored
      c9b90452
    • Josh Story's avatar
      Keep cached root parameters out of generic fallback shells (#98950) · 2d895935
      Josh Story authored
      ## Summary
      
      Replace #98892 with a fix for both ways root-dependent content can enter
      a generic fallback shell: reusing an existing Resume Data Cache entry
      and executing a fresh cache fill.
      
      For example, cached English content produced for `/en/items/one` remains
      reusable in `/en/items/[slug]`, but must be absent from
      `/[lang]/items/[slug]`. When reusing that concrete prerender as a seed,
      clone its cache map and replace entries whose recorded
      `readRootParamNames` intersect the unknown roots with omission markers.
      The original seed is unchanged.
      
      Keep those markers in the cache map itself, not a separate collection
      that must stay synchronized. They carry the reason for a hole between
      prerender passes and are never serialized into the persisted RDC.
      Preserve canary's distinction between URL data and session data when
      computing shell and prefetch hints.
      
      For fresh fills, an unknown root read suspends the entire cache
      invocation, including cached components with an internal Suspense
      boundary. Affected nested caches use independently cancellable
      prerenders. Dependencies propagate through consumers without cancelling
      independent sibling fills or saving aborted partial results.
      
      A top-level caller joining a nested cache fill must also record the
      omission marker: the nested leader has no RDC of its own. Otherwise the
      final prerender sees an unexplained miss and loses the fallback's
      prefetch hint. This applies to intra-request joins as well as
      cross-request joins.
      
      This is prerequisite work for configurable root fallbacks in #97393.
      Without the new API, ordinary misses for root parameters still block.
      The prerequisite fixture inspects ordinary build artifacts and document
      requests; the API fixtures exercise fresh fills through real fallback
      requests and tag invalidation. Neither uses forced rendering or
      shell-debugging hooks.
      
      ## Verification
      
      - Prerequisite root-cache fixture: five production tests pass with both
      Webpack and freshly built Turbopack.
      - API root-cache isolation and root-parameter fixtures: eleven
      production tests pass with each bundler. Fourteen closed-route
      revalidation tests also pass with Webpack after restacking.
      - The new nested-leader/top-level-join regression fails without the
      marker write with the reported unexpected-cache-miss warning, and passes
      with the write. Data-service barriers determine the ordering; no timing
      sleeps or framework test hooks are used.
      - Existing runtime prerender cache-warming coverage: eight Webpack tests
      pass, including cached pages that await params/searchParams.
      - The three focused unit suites pass together: 114 tests on this
      prerequisite and 128 on the API layer, with four snapshots each. The
      postponed-state assertion no longer snapshots Node's incidental
      async-hooks fields on promises.
      - Full workspace/native builds and package/repository type checks pass.
      - Deployment tests were not run locally for this update.
      
      <!-- NEXT_JS_LLM -->
      2d895935
    • Hendrik Liebau's avatar
      Fix missing content in Cached Navigations (#98767) · ec0abf41
      Hendrik Liebau authored
      React can render outlined elements in later `setImmediate` callbacks
      after an asynchronous cache read resolves. `cacheReady()` can resolve
      before those elements start their cached reads. The embedded prerender
      for Cached Navigations then reports unexpected cache misses and omits
      cacheable content.
      
      This change tracks pending native immediates in an `AsyncLocalStorage`
      scope around each Cache Components render. `CacheSignal` waits for that
      work before accepting a zero read count. If more native immediates
      appear before the readiness timer runs, it waits and checks again.
      Tracking does not make native immediates fast or change the existing
      explicit, task-local fast-immediate behavior.
      
      The e2e regression uses a delayed cache handler and a large outlined
      tree. It verifies that Cached Navigations reuse outlined content while
      content behind dynamic I/O remains uncached. Each test invocation uses a
      fresh cache key through `searchParams`, so cases and retries cannot
      reuse previously warmed entries.
      
      Unit tests in the existing immediates suite cover scope isolation,
      nested scheduling, cancellation, native scheduling semantics, and error
      recovery.
      
      Fixes #98543
      ec0abf41
    • Sam Poder's avatar
      [turbopack] Track members across namespace re-exports (#96396) · b1c15da6
      Sam Poder authored
      ## What?
      
      This PR closes a missed tree-shaking opportunity for libraries that
      expose a module namespace as a named export. One real-world example is
      Zod, whose public API has a structure similar to the following (and this
      pattern also appears in v0's codebase):
      
      ```js
      // user.js
      import { z } from './lib.js'
      
      console.log(z.object(), z.string(), z.defaultLocale)
      ```
      
      ```js
      // lib.js — mirrors zod/index.js
      import * as z from './external.js'
      
      export * from './external.js'
      export { z }
      export default z
      
      // external.js — mirrors zod/v4/classic/external.js
      import en from './locales/en.js'
      
      export * as locales from './locales/index.js'
      
      export const object = () => 'object'
      export const string = () => 'string'
      export const defaultLocale = en
      ```
      
      The analyzer can now preserve the information that only `object`,
      `string`, and `defaultLocale` are read from `z`, and use it after
      resolving that named export to the namespace of `external.js`.
      
      This PR is now standalone on `canary`. Its two former prerequisites have
      landed: #98680 introduced the independently reviewed
      `EsmAssetReferenceOptions` constructor refactor, and #96282 integrated
      CommonJS and ESM whole-namespace forwarding with canary's generic
      `ExportUsage::Passthrough` fixed point.
      
      ## Why?
      
      Previously, Turbopack knew that the named export `z` was used, but lost
      the static member information from expressions such as `z.object()`.
      Once `z` resolved to a namespace object, the optimizer therefore kept
      every export of `external.js` — including `locales` and all of
      `./locales/index.js` in this example.
      
      The optimization must remain conservative in several cases:
      
      - a computed property whose name cannot be determined statically, such
      as `z[key]`;
      - a namespace binding that escapes to unknown code, such as passing `z`
      to another function;
      - static and opaque uses of the same binding, where the opaque use must
      dominate narrowing;
      - live exports and method calls, whose binding and receiver semantics
      must not change.
      
      It must also avoid changing ordinary named-import behavior. A property
      read on an imported value is not proof that the value is a module
      namespace; narrowing and namespace provenance are valid only after
      re-export resolution proves that fact.
      
      ## How?
      
      ### Represent namespace-member requests explicitly
      
      The module-part model now has explicit states for this operation:
      
      - `ExportedNamespaceMember { export, member }` represents a static
      member read on a named export before re-export resolution;
      - `RenamedNamespaceMember { export, member }` represents the case after
      that export resolves to a module namespace.
      
      This avoids overloading an ordinary `Export` or an optional `member`
      field with two meanings. It also keeps existing `Export` and
      `RenamedNamespace` identities unchanged; the new variants have distinct
      hashes only for the new states.
      
      Multiple static reads and multiple aliases are tracked as independently
      keyed references, so `z.object`, `z.string`, and `z.defaultLocale` all
      survive rather than overwriting one another.
      
      ### Narrow only after proving the export is a namespace
      
      The analyzer records a statically known member on an imported binding
      while leaving the emitted member expression intact. Re-export following
      first resolves the outer named export:
      
      1. If it resolves to a namespace object, Turbopack synthesizes a
      namespace-member reference to the resolved module and contributes
      `PartialNamespaceObject({ member })` there.
      2. If it resolves to an ordinary named export, it continues to behave
      like a normal named read of the outer module. It does not mark the
      module as namespace-observable or unnecessarily disable export-name
      mangling.
      
      Dynamic property access and escaping bindings do not produce a narrowed
      member part, so they continue to retain the full namespace. When static
      and opaque uses are joined, the full-namespace use wins.
      
      The explicit module-part variants are threaded through both fragment and
      non-fragment infrastructure so they remain valid graph identities. The
      new `ExportedNamespaceMember` rewrite itself currently runs only when
      module fragments are disabled. A dedicated `moduleFragmentsEnabled:
      true` fixture verifies the supported existing split behavior without
      claiming that this new rewrite is active there.
      
      While rebasing, canary moved follow-reexport canonicalization into
      `turbopack-ecmascript` so lazy dynamic imports can carry the same
      canonicalization policy. Namespace-member handling now lives in that
      canonicalization helper as well, preserving both the new
      lazy-compilation path and this PR's namespace rewrite.
      
      ## Testing
      
      Enabled coverage includes:
      
      - the Zod-shaped snapshot showing only `object`, `string`, and
      `defaultLocale` retained while the unused locale namespace is removed;
      - multiple static members on one namespace-valued export;
      - dynamic access, escaping use, and mixed static/opaque use retaining
      the full namespace;
      - direct `export * as`, including an enabled used/unused precision
      assertion;
      - computed-string, parenthesized, optional, and missing-property reads;
      - `this`-sensitive method calls;
      - default-exported and renamed namespace values;
      - live bindings read and mutated through multiple aliases, with single
      evaluation;
      - nested namespace runtime behavior and top-level-await targets;
      - scope-hoisted, non-scope-hoisted, and module-fragment configurations;
      - export-name mangling safety and non-pessimization across #96282's
      forwarding edges.
      
      Development coverage updates both a value behind the CommonJS forwarding
      edge and a statically read namespace member, verifying HMR observes each
      new value without stale exports or runtime errors.
      
      One optimization-only limitation is documented under
      `__skipped__/namespace-value-reexport-nested`: member narrowing
      currently stops after the first namespace level for a read such as
      `z.locales.en`. The full nested runtime behavior is covered by the
      enabled `namespace-value-reexport` fixture.
      
      Local verification on the standalone canary rebase passes affected-crate
      and `next-core` checks, 14 focused execution/snapshot tests, the merged
      passthrough/annotation unit tests, 60 analyzer graph tests, `build-all`,
      and the development/HMR test. A throwaway ordinary object-valued
      named-import fixture also verified that the pre-resolution path
      preserves property values and `this` for getters and methods; it was
      removed after review.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 993ef5d6-cc80-4082-8e14-ff9ac871ce33 -->
      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>
      Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
      b1c15da6
    • Janka Uryga's avatar
      [PPF] Implement `unstable_ensureStatic = "shell" | "prefetch"` (#98191) · 1edced6f
      Janka Uryga authored
      Builds on #98129, where we made it possible for shells to be static
      while the prefetches depending on where runtime data is accessed:
      - `ensureStatic = "shell"` simply defers all runtime tracking until the
      prefetch (semantically, it's as if it was gated by `await prefetch()`).
      this means that the shell will always be considered static (although the
      prefetch can still be runtime)
      - `ensureStatic = "prefetch"` is analogous, but means that the prefetch
      should be static (semantically, it's as if it was gated by `await
      navigation()`). this effectively skips the tracking altogether, and
      *both* the shell and the prefetch will be static.
      - notably, in this mode, accessing fallback params in an ISR fallback no
      longer sets `needsRuntimeRequest` either, because the config disallows
      runtime prefetches, even if it'd let us skip waiting for the ISR
      prerender to finish.
      
      note that "static" here means "statically prerendered", as opposed to
      "rendered on demand via runtime prerender". both options still allow the
      prerender to have dynamic holes. disallowing dynamic holes altogether
      will be handled by `ensureStatic = "navigation"` in a follow up.
      
      ### Implementation notes
      
      i've also renamed `walkNeedsRuntimeCompleteness` to
      `walkCanUseRuntimeRequests` -- in practice, the function checks "is this
      a PPF route", but being PPF no longer means that runtime completeness is
      required, because `ensureStatic` deliberately gets rid of it.
      `walkCanUseRuntimeRequests` is a bit more accurate, because it tells us
      whether runtime requests are possible at all. This change (and the
      associated changes in comments) are in a separate commit for ease of
      review.
      1edced6f
    • Janka Uryga's avatar
      [PPF] Validate `unstable_ensureStatic` nesting (#98357) · 690f1ad8
      Janka Uryga authored
      `ensureStatic` forms a hierarchy: `"auto" < "shell" < "prefetch" <
      "navigation"`, with each value being more contrained than its
      predecessor.
      
      1. A child segment cannot relax constraints set by a parent segment, it
      can only tighten them
      - so `shell` in a layout and `prefetch` in a page is fine, but the
      opposite is not
      - note that setting `"auto"` in the child *is* allowed, because it means
      "unconstrained" and is compatible with all the other configs
      2. We can't have two conflicting levels set by two parallel slots (but
      `auto` is compatible with any other constraint, so it's allowed, same as
      above)
      3. If a segment sets `ensureStatic = false`, then no other segments on
      that route are allowed to constrain the route by setting anything higher
      than `auto` (this is meant as a signal for e.g. "this segment
      DELIBERATELY uses a runtime shell and should not be overridden to be
      static")
      
      Also adds exhaustive tests for all of these scenarios.
      690f1ad8
    • Sebastian "Sebbie" Silbermann's avatar
      Replace lerna task-runner usage with pnpm (#99040) · e09ac7d2
      Sebastian "Sebbie" Silbermann authored
      pnpm solves all the remaining usages of Lerna so we're switching to pnpm
      instead. The goal is to get rid of Lerna.
      e09ac7d2
    • Sebastian "Sebbie" Silbermann's avatar
      [cd] Fix release branch gate and drop dead lerna publish config (#99039) · 2884eb21
      Sebastian "Sebbie" Silbermann authored
      Mostly just updating obsolete/stale information.
      2884eb21
    • Niklas Mischkulnig's avatar
      Turbopack: fix "ModuleId not found for ident" regression (#99090) · 593cec11
      Niklas Mischkulnig authored
      Regression from #98617
      
      Closes #99082
      593cec11
    • Hendrik Liebau's avatar
      Fix private-cache segment reuse across root params (#98810) · 9806642f
      Hendrik Liebau authored
      Private caches only tracked root-param reads in development. Production
      runtime prefetches omitted these dependencies from their vary params
      metadata, allowing the client to reuse content across different
      root-param values.
      
      This extends #98674 to `"use cache: private"`. Private caches now
      collect root-param reads in production and inherit dependencies from
      nested public and private caches. The existing response-level
      propagation can then record those dependencies when it consumes the
      cache entry.
      
      Regression tests cover direct reads, public caches inside private
      caches, and private caches inside private caches. Each case prefetches
      English and German content, then verifies that navigation uses the
      German result without another request.
      9806642f
    • Niklas Mischkulnig's avatar
      Turbopack: fix `Unknown module type` error for imports in webpack loaders (#99088) · 3e4af55d
      Niklas Mischkulnig authored
      Fixes an error like
      ```
      ./node_modules/.pnpm/@esbuild+linux-x64@0.28.1/node_modules/@esbuild/linux-x64/README.md
      Error: Unknown module type
      This module doesn't have an associated type. Use a known file extension, or register a loader for it.
      ```
      
      Regression from https://github.com/vercel/next.js/pull/95732
      3e4af55d
    • Jiwon Choi's avatar
      Nudge humans to adopt Future Defaults (#98874) · 7f79552e
      Jiwon Choi authored
      Stacked on #98873.
      
      Counter part of agent nudge for auto upgrade. Prompt user when runs
      `next dev` or `next build` based on `experimental.agenticAutoUpgrade`
      value. This PR covers `future`.
      7f79552e
    • Jiwon Choi's avatar
      Nudge latest version upgrades for manual `next dev|build` (#98873) · 59a5fae3
      Jiwon Choi authored
      Stacked on #98872.
      
      Counter part of agent nudge for auto upgrade. Prompt user when runs
      `next dev` or `next build` based on `experimental.agenticAutoUpgrade`
      value. This PR covers `latest`.
      59a5fae3
    • Jiwon Choi's avatar
      Nudge security upgrades for manual `next dev|build` (#98872) · 447e018f
      Jiwon Choi authored
      Counter part of agent nudge. Prompt user when runs `next dev` or `next
      build` based on `experimental.agenticAutoUpgrade` value. This PR covers
      `security`.
      447e018f
    • next-js-bot[bot]'s avatar
    • Tobias Koppers's avatar
      refactor(turbo-rcstr): drop unsupported 16-byte pointer width (#98355) · cde6fad2
      Tobias Koppers authored
      ## What?
      
      Removes turbo-rcstr's 16-byte/128-bit pointer representation and the
      unused `atom_size_64` feature plumbing. Unsupported pointer widths now
      fail with an error that names the supported 32-bit and 64-bit widths.
      
      ## Why?
      
      This follows up on review feedback from #97577. The previous negative
      cfg made unknown pointer widths fall through to the 64-bit
      representation, while the 16-bit implementation and `atom_size_64`
      features had no users. Making both supported widths explicit keeps
      representation assumptions visible and produces a useful failure for
      unsupported targets.
      
      ## How?
      
      The narrow tagged-value layout is now specific to 32-bit targets, and
      the pointer-sized layout is specific to 64-bit targets. `atom_size_128`
      remains unchanged. The dead feature declarations are removed from
      turbo-rcstr and its proc-macro crate.
      
      ## Verification
      
      - `cargo test -p turbo-rcstr --lib`
      - `cargo test -p turbo-rcstr --lib --target wasm32-wasip1-threads`
      - `cargo check -p next-napi-bindings`
      - `cargo check -p next-napi-bindings --target wasm32-wasip1-threads`
      - `cargo clippy -p turbo-rcstr -p turbo-rcstr-macros -- -D warnings`
      - `cargo clippy -p turbo-rcstr -p turbo-rcstr-macros --target
      wasm32-wasip1-threads -- -D warnings`
      - `cargo fmt --all -- --check`
      
      <!-- NEXT_JS_LLM -->
      
      <!-- fleet 7cfc7d6e-efc8-4ef3-b81c-b90f71291bb0 -->
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
      cde6fad2