1. 02 Oct, 2026 40 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.58 · 1bcedb48
      next-js-bot[bot] authored
      1bcedb48
    • Luke Sandberg's avatar
      Optimize esm exports by shifting the protocol burden to getters (#98932) · 680081dc
      Luke Sandberg authored
      To support live bindings and cyclic references we bind esm exports as
      getter properties. However this is ambiguous with binding raw values, so
      we would always use `0` as a tag to flag that the next value was a
      _value_ not a getter function.
      
      In practice value exports account for 90% of exports and getters only
      10% (from vercel-site). So this changes the protocol so the getter
      functions require tags instead saving a small number of bytes in the
      output.
      680081dc
    • 0x44's avatar
      fix: fix pnpm builds in Docker examples (#97352) · 62e0b0a8
      0x44 authored
      ## What?
      
      Fix pnpm 11 dependency installation in the Node.js Docker variants of:
      
      - `examples/with-docker`
      - `examples/with-docker-export-output`
      
      This change:
      
      - adds a narrowly scoped pnpm build policy for `sharp` to both examples
      - copies `pnpm-workspace.yaml` into all three pnpm-capable Docker
      dependency stages
      - makes `Dockerfile.serve` copy optional `.npmrc` configuration
      consistently with the other Node.js Dockerfiles
      
      ## Why?
      
      The Dockerfiles run `pnpm install --frozen-lockfile`, but they do not
      provide an explicit build-script policy for `sharp`, an optional Next.js
      dependency.
      
      With pnpm 11, dependency build scripts require an explicit decision. The
      documented Docker build consequently exits during dependency
      installation with:
      
      ```text
      ERR_PNPM_IGNORED_BUILDS Ignored build scripts: sharp@0.34.5
      
      Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.
      ```
      
      The same installation pattern appears in three Dockerfiles:
      
      - `examples/with-docker/Dockerfile`
      - `examples/with-docker-export-output/Dockerfile`
      - `examples/with-docker-export-output/Dockerfile.serve`
      
      ## How?
      
      Each example now includes the following pnpm policy:
      
      ```yaml
      allowBuilds:
        sharp: false
      ```
      
      This records an explicit decision not to run Sharp's lifecycle script.
      Sharp provides prebuilt binaries for the platforms supported by Next.js,
      so the Docker examples do not need to grant the script permission to
      execute.
      
      Each affected dependency stage copies `pnpm-workspace.yaml` before
      running the frozen installation. `Dockerfile.serve` also copies optional
      `.npmrc` configuration for consistency.
      
      The npm and Yarn installation branches are unchanged, and the Bun
      Dockerfile is unaffected.
      
      ## Validation
      
      - [x] `docker build --no-cache -t nextjs-standalone-image
      examples/with-docker`
      - [x] `docker build --no-cache -t nextjs-static-export
      examples/with-docker-export-output`
      - [x] `docker build --no-cache -f
      examples/with-docker-export-output/Dockerfile.serve -t
      nextjs-static-export-serve examples/with-docker-export-output`
      - [x] Confirmed that `ERR_PNPM_IGNORED_BUILDS` is no longer reported
      - [x] Confirmed that neither `pnpm-lock.yaml` file changes
      - [x] `git diff --check`
      
      <!-- NEXT_JS_LLM -->
      62e0b0a8
    • Luke Sandberg's avatar
      Assert transient task references are not serialized (#99300) · 51c04a95
      Luke Sandberg authored
      ### What?
      Assert in debug builds that transient `TaskId`s and packed `RawVc`
      references are not serialized by bincode or serde.
      
      ### Why?
      Transient tasks do not survive a restart. #99383 avoids serializing
      suspended operations by waiting for them to settle; this encoding-time
      guard catches transient references that reach any remaining
      serialization path.
      
      If we don't filter transient task references, then warm builds attempt
      to recover missing tasks which is ambiguous with a GC bug.
      
      ### How?
      Replace the derived bincode `Encode` and serde `Serialize`
      implementations for both types with equivalent implementations that
      validate transience before delegating to the same underlying fields.
      Existing wire formats, deserialization, and release-mode behavior remain
      unchanged.
      
      Stacked on #99249, above #99383.
      
      <!-- fleet e2b0931e-5002-47b5-b5e1-3a96fbc88cab -->
      
      ---------
      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>
      51c04a95
    • Will Binns-Smith's avatar
      Reorganize bundle analyzer toolbar (#98920) · 4868b992
      Will Binns-Smith authored
      ## Summary
      
      Split the bundle analyzer toolbar into two rows so route context,
      comparison controls, and search remain separate from filtering and view
      controls.
      
      Keep the layout usable at narrow viewport widths by wrapping the route
      selector and allowing the filter strip to scroll horizontally.
      
      ## Verification
      
      - `pnpm --filter @next/bundle-analyzer-ui exec tsc --noEmit`
      - `pnpm --filter @next/bundle-analyzer-ui build`
      - Checked the analyzer layout at desktop, 900px, and 390px viewport
      widths
      
      <!-- 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>
      4868b992
    • Will Binns-Smith's avatar
      Show async module scope in bundle analyzer (#98918) · 3737d0ff
      Will Binns-Smith authored
      ### What?
      
      Show source load scope in the bundle analyzer's single-build view: label
      async-only and mixed sources in the table, mark them in the treemap with
      a legend, and add an **Initial only** filter.
      
      ### Why?
      
      Help distinguish sources reachable only behind an async import boundary
      from sources reachable through an initial path (or both). This describes
      **module-graph reachability**, not when a browser actually requests a
      chunk.
      
      ### How?
      
      Traverse the route's active-entry module graph, propagating initial,
      async, and traced reachability across dependencies. Combine the reached
      module scopes for each source, then pass the resulting classification to
      the table, treemap, and filter. The new filter and indicators apply to
      the single-build view; the comparison view keeps its existing behavior.
      
      **Verification:** Bundle-analyzer typecheck, focused lint/format checks,
      and production build passed; all eight combinations of the scope flags
      were checked when simplifying the classification logic.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet d4ca0cb7-1e23-4f73-ac4e-5a6271239015 -->
      
      ---------
      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>
      3737d0ff
    • Will Binns-Smith's avatar
      Show bundle changes in compare treemap (#98837) · b8e22809
      Will Binns-Smith authored
      ## Summary
      
      Size compare-treemap nodes by the absolute module-size delta and use
      color to show whether each module grew or shrank.
      
      Build the view from changed modules in both snapshots so removed modules
      remain visible. Group generated chunks without usable source mappings
      under `Unattributed output` instead of presenting them as source
      modules.
      
      ## Verification
      
      - `pnpm --filter @next/bundle-analyzer-ui exec eslint
      components/diff-treemap.tsx components/treemap-visualizer.tsx
      lib/diff-treemap-layout.ts`
      - `pnpm --filter @next/bundle-analyzer-ui exec tsc --noEmit`
      
      <!-- 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>
      b8e22809
    • Luke Sandberg's avatar
      improve disk read semantics around MustExist and AllowMissing (#99249) · 014e821c
      Luke Sandberg authored
      Ensure two concurrent reads of a missing task both observe it as
      missing: `AllowMissing` returns `None` for both, and `MustExist` panics
      for both, rather than letting one reader mistake an intermediate blank
      entry for a task. A missing requested Data or Meta key is conclusive;
      the restore path also avoids retrying that key in a busy loop.
      
      Add focused coverage for `task_pair`, `prepare_tasks`, missing
      categories, and restore races. Stacked on #99383, which removes
      suspended-operation serialization; this PR no longer filters persisted
      operations.
      
      <!-- fleet e2b0931e-5002-47b5-b5e1-3a96fbc88cab -->
      
      ---------
      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>
      014e821c
    • Tobias Koppers's avatar
      Allow opt-in facade-backed export mangling (#99309) · a7640687
      Tobias Koppers authored
      ## Summary
      
      The rollback in #99285 keeps local-only modules unsplit by default to
      avoid the remote-components singleton regression in #99279. This
      follow-up preserves facade-backed export mangling as an **opt-in** for
      applications that benefit from shorter keys even when a namespace
      escapes.
      
      `experimental.turbopackMangleViaMaterializedNamespaceObject` controls
      the split independently from `turbopackMangleExportNames`. If unset, it
      is enabled only when `turbopackMangleExportNames` is explicitly `true`;
      canary's implicit production mangling does **not** enable it. An
      explicit `false` wins. The option reaches both server and client
      Turbopack contexts; re-export splitting and ordinary export mangling are
      unchanged. The config and splitting comments document the compatibility
      risk for code that patches modules split into multiple parts.
      
      ## Verification
      
      - Turbopack execution: 313 passed with the facade option enabled by
      default in the **test harness**, including the original mixed-import
      regression explicitly opted out and a no-export-mangling control.
      Escaping-namespace fixtures also verify facade-backed mangling retains
      original public names. Snapshots: 132 passed. The production defaults
      are unchanged.
      - Turbopack ECMAScript unit tests: 590 passed; Next core unit tests: 82
      passed after removing the config-default helper test requested in
      review.
      - `pnpm build-all` (18/18 tasks), `pnpm --filter next types`, formatting
      and lint-staged checks passed.
      - Production Turbopack emit-collect fixture: 9 tests and 18 snapshots
      passed with defaults.
      - A scratch production Next.js app confirmed the module has facade and
      `<locals>` IDs with explicit export mangling and the new option inferred
      on, but no `<locals>` ID when the new option is explicitly off or both
      options are omitted. The scratch app is not included.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet faf1202d-c919-4f7d-bb74-d3fe954bbc57 -->
      
      ---------
      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>
      a7640687
    • Will Binns-Smith's avatar
      Add bundle analyzer route summary (#98787) · b16348a2
      Will Binns-Smith authored
      ### What?
      
      Add a route summary homepage to the Turbopack bundle analyzer and move
      individual route analysis to `/analyze`.
      
      Precompute raw, compressed, and client bundle sizes for every route in
      Rust and emit them in one `route-summaries.json` payload. Use that
      payload to rank the largest client routes, label the route picker, and
      calculate route deltas in comparisons.
      
      ### Why?
      
      Opening the analyzer at `/` previously showed an empty treemap until a
      route was selected. Loading route sizes also required fetching every
      route's `analyze.data` payload.
      
      ### How?
      
      - Show the 15 largest client payloads with progressive disclosure and
      route search.
      - Keep route rows as links so they support browser navigation and
      opening in a new tab.
      - Use dedicated loading UI for the summary page.
      - Keep comparison controls on route analysis pages where a route is
      selected.
      
      <!-- 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>
      b16348a2
    • Luke Sandberg's avatar
      [turbo-tasks-backend] Correctly maintain outdated_collectibles to prevent… · 9b963777
      Luke Sandberg authored
      [turbo-tasks-backend] Correctly maintain outdated_collectibles to prevent unnecessary stale executions (#99386)
      
      The outdated_collectibles collection was not correctly bootstrapped on
      when starting task execution and was not leveraged when dirtying tasks
      
      This could lead to extra 'dirty' calls that would actually make tasks
      'stale' and lead to re-executions. On canary this generally means that
      tasks that read collectibles at the top level can get reexecuted if they
      change and they often do (output effects), but with this change we take
      advantage of the 'stale vs dirty' optimization to avoid that in the
      common case
      
      Depends on #99249 otherwise the new test fails flakily
      
      ---------
      Co-authored-by: 's avatarClaude Opus 5.5 (1M context) <noreply@anthropic.com>
      9b963777
    • next-js-bot[bot]'s avatar
    • Aurora Scharff's avatar
      Warn when Partial Prefetching is not configured (#99452) · 4b85c8b6
      Aurora Scharff authored
      ## Summary
      
      Warn when `cacheComponents` is enabled without an explicit
      `partialPrefetching` setting. The warning asks users to choose `true` or
      `false`, explains that `false` is only for incremental migration, and
      links to the migration guide.
      
      Document that new apps should enable both options, while existing apps
      should migrate Cache Components and Partial Prefetching incrementally.
      Both features will be enabled everywhere in the next major release, and
      the old configuration options will be removed.
      
      ## Example output
      
      ```text
      ⚠ `cacheComponents` is enabled without a corresponding `partialPrefetching` option. Set `partialPrefetching` to either `true` or `false`.
      
      The only reason to set `partialPrefetching` to `false` is if you're migrating an older Cache Components app. The initial release of Cache Components did not include Partial Prefetching. New projects should enable both Cache Components and Partial Prefetching.
      
      Both Cache Components and Partial Prefetching will be enabled everywhere in the next major release, and the old configurations will be removed.
      
      Learn more: https://nextjs.org/docs/app/guides/adopting-partial-prefetching
      ```
      
      ## Verification
      
      - `pnpm jest packages/next/src/server/config.test.ts --runInBand` (22
      tests passed)
      - Prettier and ESLint on all changed files
      - Production test matrix left to CI
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      Co-authored-by: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
      4b85c8b6
    • Luke Sandberg's avatar
      Store the Turbopack module cache in a Map (#98947) · 45f4b19c
      Luke Sandberg authored
      Maps are faster than Objects for map-like usecases such as the module
      cache
      
      The one complexity is `require.cache` which exposes the module cache as
      an object, this however is an extremely rare usecase, so we support it
      via a runtime module that re-exposes the module cache as an Object using
      a `Proxy`.
      
      ### Performance
      
      Measured with `bench/module-cost` 
      
      Module **execution** time — the phase that actually hits the cache:
      
      | measurement | obj | map | delta | 95% CI | rel |
      | --- | --- | --- | --- | --- | --- |
      | client commonjs | 13.60 ms | 13.00 ms | **−0.60 ms** | [−0.65, −0.30]
      | −4.4% |
      | pages api commonjs | 21.59 ms | 20.64 ms | **−0.95 ms** | [−1.39,
      −0.74] | −4.4% |
      | pages api esm | 33.24 ms | 32.55 ms | **−0.69 ms** | [−1.06, −0.47] |
      −2.1% |
      | client esm | 20.55 ms | 20.60 ms | +0.05 ms | [−0.25, +0.30] | noise |
      
      
      Caveat: this benchmark is a deep require chain that deliberately slams
      this codepath, so this really just confirms the claim that Maps are
      faster and this is relevant to the bundled codepaths.
      
      ---------
      Co-authored-by: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
      45f4b19c
    • Aurora Scharff's avatar
      Improve agent feedback reporting reliability (#99591) · 8542feb8
      Aurora Scharff authored
      ## What?
      
      - Keep qualifying feedback candidates through the reporting pass after
      an agent resolves or works around the issue.
      - Always include generated review URLs in the final response, regardless
      of whether the browser tab opened.
      - Let the anonymization eval accept alternate valid source fixes instead
      of requiring one function shape.
      
      ## Why?
      
      Codex and OpenCode completed the positive feedback eval but dropped the
      feedback candidate after fixing the application. The protocol also only
      required the review URL when opening the form failed, which could leave
      a successfully opened background tab difficult to find.
      
      ## How?
      
      - Clarify the short managed `AGENTS.md` block and full reporting
      protocol.
      - Assert the new managed-block guidance in the development test.
      - Reject the known broken route-helper signature in the eval while
      allowing equivalent valid implementations.
      
      ## Verification
      
      - `pnpm prettier --with-node-modules --ignore-path .prettierignore
      --write ...`
      - `npx eslint --config eslint.config.mjs --fix ...`
      - The focused development test packaged successfully, but the isolated
      local fixture could not start because a linked workspace dependency
      (`@next/env`) was unavailable. CI will run it in the complete workspace.
      
      <!-- NEXT_JS_LLM -->
      8542feb8
    • Jamiboy Mohammad's avatar
      Enable empty generateStaticParams deploy diagnostics (#99406) · e2d766f9
      Jamiboy Mohammad authored
      ## Summary
      
      Enable `empty-generate-static-params` in deploy mode by giving its
      literal and computed empty-array cases independent test instances. Each
      instance selects its route with `--debug-build-paths` and preserves
      `--debug-prerender`, then checks the failed build's diagnostic through
      rejected startup and retained build logs.
      
      Keep the existing dev overlay assertions and all four bundler-specific
      production snapshots unchanged. Add separate Turbopack deploy snapshots
      from the observed CI output, preserving Vercel's stack and code-frame
      formatting without normalizing whitespace. Both cases continue to assert
      the full diagnostic, source location, and caret position.
      
      ## Verification
      
      - Both tests and their snapshots passed locally in dev and production
      with Turbopack and Webpack; both production modes were rerun after
      adding the deploy snapshots.
      - Compared the two new snapshots exactly against the recorded failures
      from both standard and Cache Components deploy CI. Confirmed all six
      existing dev/production snapshots are unchanged.
      - Local deployment creation remains blocked by Vercel project
      permissions. The updated deployment assertions await the next CI run.
      
      <!-- NEXT_JS_LLM -->
      e2d766f9
    • Jamiboy Mohammad's avatar
      test: enable Nx deployment coverage (#99407) · dc671ee5
      Jamiboy Mohammad authored
      ## Summary
      
      Enable all four `nx-handling` assertions in deployment mode with
      Corepack and the fixture's Nx output directory,
      `dist/apps/next-nx-test/.next`.
      
      Limit Nx's Next plugin to app configs so the test harness's generated
      root `next.config.js` is not inferred as an unnamed project. Copy the
      nested app config through `patchFileWithDeployEnvAssignments()` so
      deploy mode appends the same captured experimental flags as the root
      harness, including partial prefetching. Other modes copy the config
      unchanged; the fixture no longer contains deployment aliases. Dependency
      versions, build/start commands, and all four assertions are unchanged.
      
      This is the fourth layer of stack #99535, based on #99395 (which depends
      on #99534 and #99533). Remove the migrated `@force-gate !deploy`
      exclusion to preserve this PR's deployment coverage.
      
      ## Verification
      
      - Before the shared-helper refactor, real Vercel deployments using the
      original failing preview package
      (`ee2c9472836846212e8b65127a9bd35da2a02b25`): all four assertions passed
      in both
      [normal](https://vercel.com/vtest314-next-adapter-e2e-tests/vtest314-e2e-tests/2Y9Ka9dPdvTKw4D8tsGSQ6s1TfJp)
      and
      [cache-components](https://vercel.com/vtest314-next-adapter-e2e-tests/vtest314-e2e-tests/D2rBBSd1m6sxjG5oMHHNGXcukBja)
      modes. The latter build explicitly reports Cache Components and cached
      navigations enabled.
      - After the rebase and helper refactor, local production Turbopack
      build/start against the bootstrapped source package
      (`16.4.0-canary.55`): all four assertions passed.
      - Full bootstrap (18/18 tasks), repository TypeScript, formatting,
      ESLint, and 41 existing deployment helper/lifecycle unit tests passed.
      - After the shared-helper refactor (`5f9881c566`), targeted real Vercel
      deployments against `16.4.0-canary.55`: all four assertions executed and
      passed in both
      [normal](https://vercel.com/vtest314-next-e2e-tests/vtest314-e2e-tests/DdaiGdGp9pjryuHiabhVVjYs7Yvx)
      and
      [feature-enabled](https://vercel.com/vtest314-next-e2e-tests/vtest314-e2e-tests/AfLpVfJ7k73hKBjXyfixrKY7omvY)
      modes. Both installations used the declared pnpm 10.33.0 through
      Corepack. The feature-enabled build reported Cache Components and cached
      navigations enabled; inspection of the deploy setup confirmed the same
      captured Cache Components, partial-prefetching, and cached-navigation
      assignments appended to both root and nested configs.
      
      ### CI refresh
      
      The initial Actions run for the helper refactor started before the PR
      was retargeted, so it tested a merge against `canary` (`d5d747e9`) and
      failed in upstream `param-matching-ensure-static` suites outside this
      PR. Commit `0f494fea20` has exactly the same source tree as the
      validated helper refactor and triggers a fresh run against the fourth
      layer's parent, #99395. The targeted Nx deployment results above still
      apply to this unchanged tree.
      
      <!-- NEXT_JS_LLM -->
      dc671ee5
    • Jamiboy Mohammad's avatar
      test: enable deployment coverage for monorepo fixtures (#99395) · 1a183ebd
      Jamiboy Mohammad authored
      ## Summary
      
      Enable deployment coverage for `import-meta-glob-monorepo` and
      `non-root-project-monorepo`. Both apps build under `apps/web`, so
      configure Vercel's output directory accordingly and enable Corepack to
      use the declared pnpm version for workspace installation and builds.
      
      Match `import.meta.url` against the exact source-file URL for the build
      environment, retaining the filename and percent-encoding assertions and
      Windows Turbopack path canonicalization.
      
      This is the third layer of the deployment test flag stack, based on
      #99534 (which depends on #99533). Both nested configs are prepared with
      `patchFileWithDeployEnvAssignments()`, which wraps `PatchedFileRef`,
      checks the resolved harness mode, and uses the shared
      `getDeploymentTestEnvAssignments()` helper. They capture the same static
      experimental flag list as the root harness, including partial
      prefetching. Source configs stay free of deployment aliases. Automatic
      nested-config discovery remains outside this stack.
      
      Dependency versions, assertions, and unrelated bundler/dev-mode
      restrictions are preserved. #99407 is not part of this stack.
      
      ## Verification
      
      - Full bootstrap: 18/18 tasks passed. Repository TypeScript checking,
      formatting, and ESLint passed.
      - Shared helper and existing deployment lifecycle unit tests: 41/41
      passed, covering enabled/disabled values, missing and empty values,
      escaping, and capture timing.
      - Focused local production Turbopack tests: 11/11 passed across both
      monorepo suites.
      - Real Vercel deployments against `16.4.0-canary.55`: the larger
      monorepo suite passed 10/10 assertions with flags unset and 10/10 with
      Cache Components, partial prefetching, and cached navigations enabled.
      Enabled remote logs confirmed Cache Components and cached navigations.
      - The glob suite passed its assertion in both normal and enabled modes
      on targeted retries. Both monorepo suites therefore passed 11/11
      assertions per mode across four successful real deployments. The enabled
      glob build also reported Cache Components and cached navigations.
      Initial glob attempts failed before assertions due to Vercel transport
      errors during project linking and CLI installation; no test changes were
      made for the retries.
      
      ### Follow-up helper validation
      
      - `patchFileWithDeployEnvAssignments()` now appends captured assignments
      after a newline in deploy mode, matching the root harness. Dev/start
      modes preserve the file content unchanged.
      - 41/41 unit tests, 11/11 local production assertions, and the glob
      suite's dev assertion passed. Full bootstrap (18/18), TypeScript,
      formatting, and ESLint passed.
      - A fresh feature-enabled deployment of the larger monorepo suite
      installed and enabled the feature flags, but passed 8/10 assertions: the
      two encoded server source URLs used `/var/task/` instead of the asserted
      `/vercel/path0/`. Assertions are preserved; this deployment is not
      recorded as a suite pass. The feature-enabled glob deployment passed its
      assertion. Overall deploy result: 9 passed, 2 failed.
      
      - Append-placement follow-up: 10 standalone VM behavior checks passed
      using the actual helper, mode declaration, and assignment generator,
      including dev/start preservation and deploy files ending without a
      newline or with a line comment. The 41 unit tests, full bootstrap
      (18/18), repository TypeScript, formatting, and ESLint also passed.
      Deployment tests were not rerun for this placement change; the
      source-URL failures above remain unresolved.
      
      <!-- NEXT_JS_LLM -->
      1a183ebd
    • Jamiboy Mohammad's avatar
      test: capture deployment experimental flags in config (#99534) · 9dd33e01
      Jamiboy Mohammad authored
      ## Summary
      
      Capture the partial-prefetching and cached-navigation test flags in
      deployed configs through the shared helper introduced in #99533,
      matching Cache Components. The helper owns the static list of
      experimental flags; the deploy harness no longer sends or translates the
      corresponding `NEXT_PRIVATE_EXPERIMENTAL_*` aliases. The fixed
      `NEXT_PRIVATE_TEST_MODE=e2e` mode setup is retained.
      
      This is the second layer of the stack. The monorepo fixtures in #99395
      will use the same helper for their copied nested configs.
      
      ## Verification
      
      - Executed generated assignments for all three flags, covering
      enabled/disabled values, omitted values, string escaping, and capture
      timing. Together with the existing deployment lifecycle suite: 41/41
      unit tests passed.
      - Real Vercel deployments of
      `test/e2e/app-dir/hello-world/hello-world.test.ts` against
      `16.4.0-canary.55`: 4/4 assertions passed with flags unset and 4/4 with
      all three flags enabled. The enabled build explicitly reported Cache
      Components and cached navigations enabled.
      - Full bootstrap (18/18 tasks), formatting, and ESLint passed.
      
      <!-- NEXT_JS_LLM -->
      9dd33e01
    • Jamiboy Mohammad's avatar
      test: extract a shared helper for deployment feature flags (#99533) · dfb6e044
      Jamiboy Mohammad authored
      ## Summary
      
      Extract the root deploy harness's Cache Components flag capture into a
      dependency-free helper that can also be used when preparing nested app
      configs. The helper owns a static flag list and emits locally captured
      JavaScript assignments; it requires no import from the deployed fixture.
      The root config keeps its existing assignment position and behavior.
      
      ## Verification
      
      - Generated assignments were executed in isolated contexts to verify
      enabled/disabled values, missing and empty values, string escaping,
      capture timing, and unrelated environment preservation. Together with
      the existing deployment lifecycle tests: 27/27 unit tests passed.
      - A focused real Vercel deployment of
      `test/e2e/test-utils-tests/basic/basic.test.ts` passed against
      `16.4.0-canary.55` with `__NEXT_CACHE_COMPONENTS=true`. The remote build
      explicitly reported Cache Components enabled.
      - Full bootstrap (18/18 tasks), repository TypeScript checking,
      formatting, and ESLint passed.
      
      <!-- NEXT_JS_LLM -->
      dfb6e044
    • Josh Story's avatar
      Move App Page header parsing to handler entrypoints (#99506) · c24d0f87
      Josh Story authored
      ## Summary
      
      Continue decoupling App Router rendering from incoming request objects
      by parsing rendering headers at the handler boundary and passing
      ParsedRequestHeaders explicitly to app-render.
      
      Share the parser across Node, Edge, legacy server, and build/export
      entrypoints. Preserve parsing after Flight-header stripping and within
      existing error boundaries; leave request-store creation and Server
      Action handling unchanged.
      
      Add behavioral coverage for an RSC-first static fallback and report-only
      CSP nonce handling, verified before and after the extraction.
      
      ## Verification
      
      - Core header, router-state validation, and CSP suites with `pnpm
      test-dev-turbo` and `pnpm test-dev-webpack` (8 tests per bundler).
      - Existing `runtime-error-events` request-ID correlation and
      `app/index.test.ts` Node/Edge Flight cases with both dev bundlers (4
      tests per bundler).
      - Cold static-fallback test with both production bundlers; CSP suite in
      production Webpack.
      - `pnpm test-start-webpack test/e2e/app-dir/app/standalone.test.ts`
      (isolated production build with Node and Edge routes).
      
      <!-- NEXT_JS_LLM -->
      c24d0f87
    • Aurora Scharff's avatar
      docs: clarify ensureStatic levels from dogfooding (#99590) · 922d2e73
      Aurora Scharff authored
      ## Summary
      
      Follow-ups to the `ensureStatic` reference from dogfooding
      `ensureStatic` on `vercel/shop` for 16.4.
      
      - **`'shell'` costs:** with `'shell'`, a `<Link prefetch={true}>` into a
      route that reads `cookies()`, `headers()`, or URL data still makes a
      runtime per-link prefetch. Each visible link triggers a server render,
      and nothing in the UI shows it. The `'shell'` section now says so and
      points to `'prefetch'`.
      - **Fallback shell on first visit:** under `'prefetch'`, a per-link
      prefetch for params not returned by `generateStaticParams()` serves the
      fallback shell until the page is generated in the background. On a fresh
      deployment, the first navigation to those URLs can show the shell. The
      `'prefetch'` section now explains this and links the ISR guide.
      - **`ensureStatic` is not a stage API:** removing `await navigation()`
      because the route set `'prefetch'` moved synchronous IO
      (`crypto.randomUUID()` in a request helper) into earlier stages. A new
      "How `ensureStatic` differs from `prefetch()` and `navigation()`"
      section explains that `ensureStatic` validates which stages are static
      but does not move code.
      
      The changes are insertions only and merge cleanly with #99493, which
      edits nearby lines in the same file.
      
      ## Verification
      
      - `'shell'` deopt to runtime per-link prefetches:
      `dynamic-rendering-utils.ts` clears `shouldAttemptStaticPrefetch` for
      session and URL data unless the level is at least `Prefetch`, and the
      client sends `next-router-prefetch: 2` (`FetchStrategy.PPRRuntime`) in
      that case
      - Fallback for unlisted params under `'prefetch'`: the
      fallback-upgradeable branch in `dynamic-rendering-utils.ts` skips the
      runtime request when the level is at least `Prefetch`
      - Synchronous IO interrupting non-dynamic stages with Partial
      Prefetching: `io-utils.tsx` and `SyncIOMode.AllowedInDynamic` in
      `staged-rendering.ts`
      - Prettier and `alex` pass on the changed file
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code)
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      Co-authored-by: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
      922d2e73
    • Jiwon Choi's avatar
      Gate param-matching deploy tests on the adapter (#99582) · 440487b0
      Jiwon Choi authored
      ### Why?
      
      The legacy CLI builder doesn't support the new param-matching outputs
      yet, so these deploy tests fail without the adapter.
      
      ### How?
      
      Temporarily skip non-adapter deploys with `@force-gate !deploy ||
      adapter`. Local dev/start and adapter deploy tests still run.
      
      <!-- NEXT_JS_LLM -->
      440487b0
    • Aurora Scharff's avatar
      docs: update the MCP guide for next-devtools-mcp 0.4 (#99583) · 8cb7b04a
      Aurora Scharff authored
      ## Summary
      
      Bring the MCP guide in line with `next-devtools-mcp` 0.4.0 and the
      runtime tools on canary.
      
      - describe the four connector tools (`nextjs_index`, `nextjs_call`,
      `nextjs_docs`, `browser_eval`) and explain that the docs and browser
      tools point the agent elsewhere instead of doing the work
      - replace the Playwright MCP integration with `agent-browser`, which
      `next-browser` merged into in 16.3
      - list the runtime tools at `/_next/mcp` using the descriptions
      registered in `packages/next/src/server/mcp/tools`, including the
      previously missing `get_request_insights`, and correct `get_errors` (it
      does not return type errors) and `get_server_action_by_id` (it does not
      inspect component hierarchies)
      - add the `npx add-mcp next-devtools-mcp@latest` install option and note
      that Skills such as `next-dev-loop` call `/_next/mcp` directly
      - rebuild the example transcript with `nextjs_index` and `nextjs_call`,
      replacing the removed `nextjs_runtime` tool
      - document that the endpoint is enabled by default and can be turned off
      with `experimental.mcpServer: false`, and add that to troubleshooting
      - remove the "Using with agents" section, which repeated the
      capabilities in vaguer terms
      
      Stacked on #99293. Also removes the stale upgrade example, which relied
      on the `upgrade_nextjs_16` tool removed in `next-devtools-mcp` 0.4.0.
      
      ## Verification
      
      - Tool names and descriptions checked against
      `get-or-create-mcp-server.ts` and each tool file on canary
      - Connector tools checked against the `next-devtools-mcp` 0.4.0 README
      - `mcpServer` default checked in `config-shared.ts`
      - Prettier and `alex` pass on the changed file
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code)
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      Co-authored-by: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
      8cb7b04a
    • Jiwon Choi's avatar
      Document agent upgrades across Next.js (#99293) · d2608c10
      Jiwon Choi authored
      ### Why?
      
      Document the supported `next upgrade --agent` workflow without
      presenting the unfinished `experimental-future` policy as the
      recommended path in feature guides.
      
      ### How?
      
      - Add a human-facing Agent Upgrade guide and an
      `experimental.agentUpgrade` API reference.
      - Link the workflow from the App and Pages upgrade docs, CLI reference,
      and AI agent guide.
      - Document the `security`, `latest`, and `experimental-future` policies
      in the upgrade guide, CLI reference, and config reference.
      - Keep the dedicated Skills as the recommended path for Cache
      Components, Partial Prefetching, and the combined Instant Navigation
      migration.
      - Explain that version upgrades provide the applicable migration guides
      and Skills to the coding agent.
      - Show the interactive agent, model, reasoning, Auto-permission, and
      worktree prompts.
      - Document the non-blocking `next dev` and `next build` reminders, the
      DevTools Vulnerability Insight, and the default `security` policy from
      #99311.
      
      ### Verification
      
      - Prettier passes on all changed documentation files.
      - Targeted ESLint passes with no errors.
      - Alex reports no new warnings in the changed content.
      - Feature guides recommend the dedicated Skills instead of
      `experimental-future`.
      
      <!-- NEXT_JS_LLM -->
      
      Closes NAR-944
      
      ---------
      Co-authored-by: 's avatarAurora Scharff <aurora.sofie@gmail.com>
      Co-authored-by: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
      d2608c10
    • Hendrik Liebau's avatar
      [test] Fix the legacy image preload order assertion for React 18 (#99572) · 8e0700c7
      Hendrik Liebau authored
      PR #99528 removed the automatic individual-test retries introduced in
      #89929. This exposed a failure in the React 18.3.1 canary job:
      https://github.com/vercel/next.js/actions/runs/36976099741/job/110749496538
      
      The test checked preload order in the hydrated DOM. React 18's
      client-side `next/head` updates can reorder those links, although the
      SSR HTML already places CSS preloads before image preloads.
      
      Jest deferred the failed test's retry until the end of the describe
      block. A later test had moved the shared browser to `/loader-prop` by
      then. That page has no preloads, so the retried assertion passed without
      checking the intended page's preload order.
      
      The assertion now checks the SSR HTML for `/` directly. It requires both
      CSS and image preloads and verifies that all CSS preloads precede the
      image preloads.
      
      Verified by adding the `run-react-18-tests` label to the PR on creation.
      8e0700c7
    • Benjamin Woodruff ‮'s avatar
      docs: Remove task decomposition and validation boilerplate from AGENTS.md (#99558) · 621015d4
      Benjamin Woodruff authored
      This was added in #89640.
      
      Every agent should already know how to do this stuff, we shouldn't
      declare it.
      
      I think this was making my agent create insane unit tests for code that
      didn't really need dedicated unit tests.
      621015d4
    • Benjamin Woodruff ‮'s avatar
    • Hendrik Liebau's avatar
      [test] Expose first-run e2e test failures in CI (#99528) · c6345b09
      Hendrik Liebau authored
      PR #89929 added automatic retries of individual e2e tests to reduce CI
      time. These retries reuse the fixture without rerunning `beforeAll`. A
      failed attempt can write an ISR cache or change other state. The retry
      can then pass against a different starting state, potentially hiding a
      real issue.
      
      Each CI test job runs a shard containing multiple test files.
      Previously, rerunning a failed job also reran the files that had already
      passed. PR #92832 caches passing results so a job rerun can skip those
      files and rerun only the failed files. This reduces both retry cost and
      time, allowing us to remove the individual-test retries.
      
      This change preserves the timeout improvements from #89929. It also
      removes the redundant retry opt-out and updates stale comments and
      test-gate documentation.
      
      The retry removal also exposed test assumptions that required these
      changes:
      
      - Both concurrent root-param cache tests now exclude deploy mode.
      Cross-request deduplication requires requests to share a server process,
      but deployed requests can reach different function instances. The tests
      remain enabled in dev and `next start`.
      - Both affected App Shell tests now refresh and repeat only the
      preparatory prefetch until root-specific shell segments arrive. Deploy
      can initially serve generic fallback segments while ISR generates a
      shell for unprerendered root params; `next start` generates that shell
      blockingly. The cache-reuse and navigation assertions remain outside the
      retry. The static-shell test also loads a fresh home page to prevent
      BFCache from restoring visible accordions, then primes both language
      variants. The TODOs leave the direction for consolidating the serving
      behavior open.
      
      The [deploy run and
      rerun](https://github.com/vercel/next.js/actions/runs/36878368304/attempts/2)
      exposed the failures addressed by these test corrections.
      c6345b09
    • Benjamin Woodruff ‮'s avatar
      Turbopack: `resolveFileUrl`/`placeholderFileUrl` is always called with a module path (#99560) · 6c2ab2c2
      Benjamin Woodruff authored
      Follow-up from
      https://github.com/vercel/next.js/pull/99511#discussion_r4161127192
      
      This runtime function is only ever called from generated code, which
      always passes this argument.
      6c2ab2c2
    • Benjamin Woodruff ‮'s avatar
      Turbopack: Remove implicit mismatched root fallthrough for… · 9a9ea121
      Benjamin Woodruff authored
      Turbopack: Remove implicit mismatched root fallthrough for AfterResolvePluginCondition, accept None as a root (#99556)
      
      `AfterResolvePluginCondition` would ignore the root path if the
      `ResolvedVc<FileSystem>`s didn't match, which worked for additional
      roots, but is surprising implicit behavior. Make it explicit by
      requiring `None` if you don't want to match a specific root.
      9a9ea121
    • Benjamin Woodruff ‮'s avatar
      Turbopack: Allow ResolveMap entries to match against all possible roots (#99555) · 84eb323f
      Benjamin Woodruff authored
      `get_next_client_resolved_map` shouldn't require the glob match within a
      specific root, because the package could be in the package manager's
      GVS, which can be configured as an additional root.
      84eb323f
    • Benjamin Woodruff ‮'s avatar
      Turbopack: Support import.meta.url in additional roots (#99511) · aa78e963
      Benjamin Woodruff authored
      ## Current State
      
      - In the runtime, `import.meta.url` tries to give you a real on-disk
      path if the file exists in the project filesystem and you're running in
      node. If you're running in the browser you get a fake `file:///ROOT/...`
      URL.
      - `__dirname` and `__filename` always give fake `/ROOT/...` paths
      
      This panics if `import.meta.url` exists in an additional root.
      
      ## Proposed Modification
      
      If `import.meta.url` exists in an additional root, just give a fake
      `file:///@rootName/...` URL.
      
      Common cases where you're reading a file relative to `import.meta.url`
      should still work, as those are handled by the analyzer. Externalized
      node modules should be unaffected because they don't call the Turbopack
      runtime for `import.meta.url`.
      
      ---------
      Co-authored-by: 's avatarClaude <noreply@anthropic.com>
      aa78e963
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.57 · 3683479a
      next-js-bot[bot] authored
      3683479a
    • Jiwon Choi's avatar
      Resolve React dependency warnings from the target app (#99536) · d5e43557
      Jiwon Choi authored
      ### Why?
      
      React dependency warnings resolve from the CLI installation, which can
      report missing packages that are already installed in the target app.
      
      ### How?
      
      Use a shared check against each command's resolved app directory,
      preserving explicit app paths and forwarded test-runner arguments.
      
      <!-- NEXT_JS_LLM -->
      d5e43557
    • Jiwon Choi's avatar
      Move upgrade workflows out of public docs (#99546) · ebb63d01
      Jiwon Choi authored
      Stacked on #99545.
      
      ### Why?
      
      The draft agent upgrade workflows are internal instructions, but
      currently ship alongside public documentation. Keep them beside the
      upgrade implementation and outside the public docs bundle.
      
      ### How?
      
      Move the four workflows to `src/lib/upgrade/*.md` and copy them to
      `dist/lib/upgrade` with Taskr. Update `next upgrade` to prepare them
      under the temporary `upgrade/` directory, including their guide
      references and prompt assertions. Public migration guides remain in
      `dist/docs`.
      
      Verified the Taskr copy output. Full local build, lint, and unit-test
      verification remain unavailable because workspace dependencies are
      missing.
      ebb63d01
    • Jiwon Choi's avatar
      Use Agent terminology throughout upgrades (#99545) · 4e0e573a
      Jiwon Choi authored
      ### Why?
      
      Use consistent Agent terminology for the upgrade command and lifecycle
      reporting.
      
      ### How?
      
      Replace `--ai` and `--experimental-ai` with `--agent`, and update
      upgrade recommendations, DevTools prompts, tests, and eval fixtures.
      Rename the telemetry module, types and event names, hidden completion
      reporter, run-ID environment variable, and preference namespace to
      match. Telemetry events now use `NEXT_AGENT_UPGRADE_*`, and preferences
      use `agent-upgrade.*`.
      
      Formatting, TypeScript syntax, and telemetry producer smoke checks pass.
      Full local build and unit tests remain blocked by missing workspace
      dependencies.
      4e0e573a
    • Benjamin Woodruff ‮'s avatar
      Turbopack: Commit updated generated-native file (#99561) · 936fda6a
      Benjamin Woodruff authored
      Apparently I deleted this comment when I updated this file in
      https://github.com/vercel/next.js/pull/98003
      
      But Jimmy re-added it to the source code in
      https://github.com/vercel/next.js/pull/98888
      
      And both those things merged around the same time.
      936fda6a
    • Jamiboy Mohammad's avatar
      test: enable Relay multi-project deployment coverage (#99403) · 0f154e2a
      Jamiboy Mohammad authored
      ## Summary
      
      Re-enable deployment coverage for both `relay-graphql-swc-multi-project`
      projects. Corepack selects the declared pnpm version, and each setup
      copies a Vercel configuration pointing to its own output directory
      (`project-a/.next` or `project-b/.next`). Earlier deploy CI for #99192
      installed and built both projects, then failed because the harness's
      post-build script looked for `.next/BUILD_ID` at the fixture root.
      
      Remove both blanket `skipDeployment` exclusions together so both
      page-rendering tests can execute. The two existing compiler-validation
      checks remain skipped in deploy mode because they run a local executable
      against the fixture's installation. Dependency versions, build commands,
      and page assertions are unchanged.
      
      ## Verification
      
      - All four tests passed locally in production Turbopack mode, both
      normally and with `__NEXT_CACHE_COMPONENTS=true` and
      `__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true`.
      - Checked each generated fixture's copied `vercel.json` against its
      actual build output: both configured `BUILD_ID` paths are readable,
      while the root `.next/BUILD_ID` is absent.
      - Neither setup retains `skipDeployment`. Both normal and
      cache-components deployment manifests select the suite without excluding
      cases; actual deployment and page assertions await CI on the updated
      head.
      - The repository TypeScript check reports existing shared-`node_modules`
      build mismatches, with no errors in the changed test.
      
      <!-- NEXT_JS_LLM -->
      0f154e2a
    • Jamiboy Mohammad's avatar
      test: migrate independent App Router deploy exclusions to force gates (#99431) · f19ae744
      Jamiboy Mohammad authored
      ## Summary
      
      Replace the App Router `skipDeployment` options still present in the
      base with equivalent static `@force-gate` directives. Existing `skipped`
      bindings and checks, manual mode guards, fixture configuration,
      assertions, and hooks are preserved. Tests whose deployment exclusions
      were already removed on canary are left unchanged.
      
      The two adapter exceptions remain `!deploy || adapter`. The existing
      Turbopack restriction on the missing-root-layout suite is retained. The
      shared instant-validation suite wrapper moves to its five test entry
      points so the gate transformer can apply `!deploy`; the
      partial-prefetching variants inherit these gates.
      
      This is the independent portion of #98155, after #98160 in the
      canary-based stack containing #98158. The viewport known-limitation
      suite remains in #98155 because its lazy configuration predicate needs
      #98430.
      
      ## Verification
      
      - Compared the complete syntax trees of all 60 previously touched files
      against the base: only deployment-option removal, directly associated
      adapter bindings, and required gate-wrapper placement differ. All 120
      references to `skipped` are preserved; 27 files are now byte-for-byte
      unchanged from the base.
      - Registration-only comparisons cover 37 entry points in dev, start, and
      deploy with Webpack and Turbopack, including deploy with the adapter
      disabled. Fixture eligibility is unchanged. The already-enabled
      opaque-origin sibling is no longer suppressed by the legacy `it.only`
      placeholder.
      - TypeScript, Prettier, and ESLint passed. Registration probes disable
      bodies and hooks and use default resolved values for existing lazy
      predicates; they do not validate remote deployment builds or browser
      behavior.
      - Rebased the five open migration layers onto canary; 16 superseded
      files are unchanged from canary, with all other layer files preserved
      exactly. All 15 commits retain their authorship and signatures.
      - The 79 gate unit tests passed. Full bootstrap attempted: 14/15 tasks
      passed; the isolated worktree lacks the bundle-analyzer app
      dependencies. Browser and remote deployment execution remains for CI.
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      Co-authored-by: 's avatarJosh Story <gnoff@storyposted.com>
      f19ae744