1. 04 Oct, 2026 3 commits
  2. 03 Oct, 2026 7 commits
    • Luke Sandberg's avatar
      Followup from #99249 remove some redundant tests and enable missing assertions… · dc7bf6e6
      Luke Sandberg authored
      Followup from #99249  remove some redundant tests and enable missing assertions all the time (#99605)
      
      Followup from #99249 
      
      Removing the redundant tests for basic hygiene reasons, but enabling the
      `MustExist` assertions to improve consistency with `task`
      
      `task()` always fails if the task doesn't exist, now `prepare_tasks`
      does as well.
      dc7bf6e6
    • Luke Sandberg's avatar
      Simplify turbo-tasks-backend guards and execution contexts (#99599) · ab75f649
      Luke Sandberg authored
      ### What?
      
      Simplify the task guard and execution context abstractions in
      `turbo-tasks-backend`, including the companion child context used for
      parallel work.
      
      Followup from #99249
      
      ### Why?
      
      Each trait has a single implementation, with no alternate
      implementations or mocks using the abstraction. The trait layer adds
      duplicate declarations, associated types, and generic plumbing without
      providing a useful extension point today. This is a simplicity refactor,
      not a performance optimization.
      
      
      <!-- fleet 22e7fce7-cf14-4d21-9cb9-d77f674cb241 -->
      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>
      ab75f649
    • Luke Sandberg's avatar
      Add allocation and memory data to the trace-server MCP protocol (#98546) · 2d5a45a5
      Luke Sandberg authored
      ### What?
      
      Makes the trace-server MCP tool usable for memory investigations and
      improve usability/performance based on agent feedback ♾️
      
      * Spans now report allocation data (`allocations` / `deallocations` /
      `persistentAllocations` / `allocationCount`, each with a `self*`
      counterpart excluding children), plus `memorySummary` and
      `heaviestSpanId`.
      
      * `search` became recursive, and `depth` / `pageSize` were added so a
      caller can pull a subtree or a wide page in one call instead of one
      round-trip per level.
      
      ---------
      Co-authored-by: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
      2d5a45a5
    • Tobias Koppers's avatar
      turbo-tasks-backend: check access in track_modification and only track Data on… · 86d92b94
      Tobias Koppers authored
      turbo-tasks-backend: check access in track_modification and only track Data on serialization invalidation (#99581)
      
      ### What?
      
      Turbo-tasks backend: when a task guard marks a category (Data or Meta)
      of a persistent task as modified, it now checks that the guard was
      acquired with that category. Serialization invalidation now marks only
      Data as modified.
      
      ### Why?
      
      Marking a category as modified means the next snapshot writes the
      in-memory copy of that category to disk. If the category was never
      restored, the in-memory copy is empty, and the snapshot overwrites the
      real persisted data.
      
      `invalidate_serialization` hit exactly this case:
      
      - The backend acquires the task with Data access only.
      - The guard then marked both Data and Meta as modified, bypassing any
      access check.
      - After an eviction, mutating a `State` stored in a cell therefore
      persisted an empty Meta.
      - On the next restore the task's output was gone, so the task silently
      re-executed.
      
      ### How?
      
      - **Access check.** `TaskGuardImpl::track_modification` runs the
      existing debug access assertion before delegating for non-transient
      tasks. Transient tasks are still skipped.
      - Every caller is now covered, including the macro-generated accessors
      and the hand-written cell-data mutators.
      - Any future mismatch fails loudly in debug builds and tests instead of
      corrupting persisted state.
      - **Data only for serialization invalidation.** Serialization
      invalidation concerns cell data (for example a `State` mutated in
      place), so it now marks only Data, through the checked guard path rather
      than the raw storage guard.
      - **Audit of the remaining callers.** None of them track a category they
      don't hold:
        - GC tombstoning and resurrection acquire `All`.
        - The cell-data mutators check Data.
        - New-task initialization restores `All`.
      - The generated accessors derive the check and the tracked category from
      the same field category.
      - **Regression test.** `tests/invalidate_serialization.rs` runs a task
      whose cell holds a `State` and snapshots/evicts it (asserting that both
      Data and Meta were evicted). It then mutates the state, snapshots again,
      and asserts the task is served from cache without re-executing.
      - The test deliberately has no readers of the state. A re-executing
      dependent would restore the task's Meta before the snapshot and hide the
      bug.
        - With the old tracking it fails on every run; with the fix it passes.
      
      Verified with `cargo test -p turbo-tasks-backend` (debug build, so the
      access assertions are active), plus clippy and rustfmt.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet c78c9059-116c-46e3-8ab3-5adc412156f1 -->
      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>
      86d92b94
    • Luke Sandberg's avatar
      Fix CI break caused by #98932 (#99621) · 59644380
      Luke Sandberg authored
      No idea how that PR had a clean bill of health?
      
      Some kind of race with export mangling getting enabled by default?
      59644380
    • Andrew Clark's avatar
      Fix: Unnecessary Suspense fallback triggered by URL update (#99612) · 65498960
      Andrew Clark authored
      Every router state update is supposed to be wrapped in startTransition,
      but restores weren't. A restore syncs the router with a userland
      `history.pushState` / `history.replaceState`, a back/forward navigation
      between those entries, or a page restored from the bfcache. The callers
      dispatch it inside `startTransition`, but the action queue applied every
      reducer result in a later microtask, after that scope had closed. So
      anything that suspended on the new URL replaced the current content with
      the nearest Suspense fallback.
      
      The microtask came from wrapping the reducer in an async function, back
      when reducers switched from throwing promises to returning them
      (#56497). The queue already handles both kinds of results, so it now
      calls the reducer directly and applies a synchronous result right away.
      A reducer that throws is handled the same way a rejection was. This was
      tried before in #77582 and reverted in #77909 because of a performance
      regression that was seen internally.
      
      Back/forward now gets React's usual popstate behavior: a Transition
      that's scheduled during a `popstate` event renders synchronously.
      
      This also removes the special case that dispatched the bfcache restore
      as an urgent update. It was meant to stop the router from rendering a
      stale MPA navigation and firing it again. But that state only exists in
      a Transition that suspends and never commits, so a restore that's also a
      Transition renders in the same pass. The bfcache test now covers this in
      headless browsers too, by simulating the `pageshow` event.
      
      Thanks to @controversial, who found the cause and wrote the original
      test in #99537.
      Co-authored-by: 's avatarLuke Deen Taylor <10377391+controversial@users.noreply.github.com>
      65498960
    • Andrew Clark's avatar
      Don't suspend client params on shallow URL updates (#99611) · 01dd81eb
      Andrew Clark authored
      With Cache Components enabled, a client page or layout that reads
      `use(params)` or `use(searchParams)` showed the nearest Suspense
      fallback on every `history.pushState` / `history.replaceState`, and when
      going back and forward between those entries. The content was hidden for
      a few hundred milliseconds each time, so a focused input lost focus and
      dropped keystrokes.
      
      Since the `params` and `searchParams` are already known on the client
      during a render triggered by a navigation, there's no reason for them to
      suspend. They were only suspending because we created a fresh promise on
      each render.
      
      We can instead mark the promise as fulfilled up front, by setting the
      same `status` and `value` fields React sets once it has tracked a
      promise. This is the internal protocol React uses to synchronously
      unwrap resolved promises.
      
      Ideally we would also avoid recomputing them on every render, only when
      the router tree actually changes, but we can address that separately.
      
      Thanks to @controversial, who found the cause and wrote the tests in
      #99537.
      
      Fixes #99512.
      Co-authored-by: 's avatarLuke Deen Taylor <10377391+controversial@users.noreply.github.com>
      01dd81eb
  3. 02 Oct, 2026 30 commits
    • Will Binns-Smith's avatar
    • 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