1. 23 May, 2026 2 commits
  2. 22 May, 2026 8 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.27 · 56c9e85d
      next-js-bot[bot] authored
      56c9e85d
    • Tim Neutkens's avatar
      Add Chromium-only Playwright image publisher (#94051) · 1cb0958b
      Tim Neutkens authored
      ### What?
      
      Add the Next.js-owned Chromium-only Playwright image definition and a
      workflow that builds and pushes it to GHCR.
      
      ### Why?
      
      This needs to merge before the reusable CI workflow starts using the
      image, so the GHCR tag exists when job containers are initialized.
      
      ### How?
      
      - Add a Noble-based Chromium image with the CI build dependencies,
      Playwright Chromium, and the repository's Node.js LTS version
      preinstalled.
      - Add a manual/canary-only publisher workflow that derives Playwright
      from `package.json`, Node.js from `build_reusable.yml`, and tags images
      with a Next.js-owned revision suffix.
      - Keep the image revision in the publisher workflow so Dockerfile-only
      changes can publish a distinct immutable tag.
      
      ### Verification
      
      - `git diff --cached --check`
      - `ruby -e 'require "yaml";
      YAML.load_file(".github/workflows/playwright_chromium_image.yml")'`
      - Not run: `docker buildx build --check --build-arg
      PLAYWRIGHT_VERSION=1.58.2 .github/images/playwright-chromium` (Docker
      daemon is not running locally)
      - Not run: `pnpm prettier --with-node-modules --ignore-path
      .prettierignore --write .github/workflows/playwright_chromium_image.yml
      .github/images/playwright-chromium/Dockerfile` (`prettier` command is
      not available in this checkout)
      
      <!-- NEXT_JS_LLM_PR -->
      1cb0958b
    • Sam Selikoff's avatar
      Instant navs devtools revamp (#94027) · a3451408
      Sam Selikoff authored
      This updates the Instant Navs DevTools panel to better model capture
      state across pending, SPA, and MPA navigations.
      
      - Revamps the Navigation Inspector UI states, controls, focus behavior,
      and panel transitions
      - Resets capture state when closing the panel from active capture states
      - Keeps MPA reloads and root-layout-crossing navigations from briefly
      showing stale or optimistic SPA state
      - Consolidates the panel state flow so cookie state, re-arming, and
      rendered UI status are easier to follow
      - Expands the instant navs fixture and tests to cover SPA captures, MPA
      captures, reloads, close/reset, Continue Rendering, and root-layout MPA
      links
      a3451408
    • Tim Neutkens's avatar
      Prerender static metadata under dynamic segments to canonical pathname (#93873) · 765b39c4
      Tim Neutkens authored
      ### What?
      
      Fixes an invariant failure (`failed to find source route
      /dynamic/[id]/apple-icon.png for prerender
      /dynamic/[id]/apple-icon.png`) raised by the build adapter when an app
      contains static metadata files (`apple-icon.png`, `icon.png`,
      `opengraph-image.png`, `twitter-image.png`, `sitemap.xml`) under a
      dynamic segment.
      
      ### Why?
      
      Static metadata files under a dynamic segment were treated as full
      dynamic prerenders: they ended up in `prerenderManifest.dynamicRoutes`
      with `fallbackRouteParams`, but no `.body` file was exported and they
      never received an `appOutputMap` entry. The adapter's `dynamicRoutes`
      loop then asked `getParentOutput` for a source route that didn't exist
      and threw.
      
      These files are content-stable across params — the route handler returns
      the same bytes for every URL that matches the dynamic pattern — so they
      should prerender once under a canonical pathname rather than be treated
      like per-param dynamic routes.
      
      ### How?
      
      - New `getStaticMetadataPrerenderPathname` helper that maps
      `/dynamic/[id]/apple-icon.png` to `/dynamic/-/apple-icon.png`. This is
      the canonical pathname already used by `fillStaticMetadataSegment` for
      HTML link emission.
      - In `build/utils.ts`, route `APP_ROUTE` entries that are static
      metadata files through a new `buildStaticMetadataStaticPaths` (one
      prerender path, no fallback params) instead of the regular
      `buildAppStaticPaths`.
      - In `build/index.ts`:
      - Rewrite each prerendered static metadata route to its `-`-placeholder
      pathname before splitting into known/unknown buckets, so it lands in
      `prerenderManifest.routes` with a `.body` file.
      - Skip static metadata entries in the `dynamicPrerenderedRoutes` loop so
      they don't get a stray `PRERENDER` manifest entry.
      - Defensive sweep before write: drop any leftover bracketed metadata
      keys from `prerenderManifest.dynamicRoutes`.
      - In the adapter, look up `prerenderManifest.routes` under the canonical
      placeholder pathname (with locale prefix when applicable) and skip
      static metadata in the `dynamicRoutes` loop.
      - Unit tests in `get-metadata-route.test.ts` lock in the placeholder
      behavior for the tricky cases: catchall, optional catchall, multi-level
      dynamic, literals between dynamics, dynamic + catchall mix.
      
      Reproduction:
      `test/e2e/app-dir/metadata-static-file/metadata-static-file-dynamic-route.test.ts`
      configured with `adapterPath` previously crashed at
      `handleBuildComplete`; all three cases in that file now pass.
      
      Runtime stays the same: arbitrary param URLs continue to be served by
      the dynamic route handler shipped with the app route; only the canonical
      `-` URL is statically served.
      
      <!-- NEXT_JS_LLM_PR -->
      765b39c4
    • Tim Neutkens's avatar
      Fix pr-status job pagination (#94049) · 685d5b9e
      Tim Neutkens authored
      ### What?
      
      Lower the GitHub Actions jobs page size used by `scripts/pr-status.js`
      and keep walking pages until all jobs are fetched. Reuse the paginated
      job fetch for flaky-test detection.
      
      ### Why?
      
      The previous `per_page=100&page=1` request for run `26093602659` returns
      HTTP 502 from GitHub because the query is too slow.
      
      ### How?
      
      Add a shared `JOBS_PAGE_SIZE = 30`, update the pagination stop condition
      to match it, and route flaky-test failed job lookup through
      `getFailedJobs()`.
      
      ### Verification
      
      - `node --check scripts/pr-status.js`
      - `pnpm prettier --with-node-modules --ignore-path .prettierignore
      --write scripts/pr-status.js`
      - `npx eslint --config eslint.config.mjs --fix scripts/pr-status.js`
      - `gh api
      "repos/vercel/next.js/actions/runs/26093602659/jobs?per_page=30&page=<n>"
      --jq ".jobs | length"` across pages 1-5 captured 137 jobs, matching
      `total_count: 137`
      - Confirmed the old `per_page=100&page=1` request still returns HTTP 502
      - Not run: full Next.js test suite (scripts-only helper change)
      
      <!-- NEXT_JS_LLM_PR -->
      685d5b9e
    • Josh Story's avatar
      Revert "Include PPR routes in dynamicRoutes regardless of revalidate time" (#94032) · 71036838
      Josh Story authored
      Reverts vercel/next.js#94025
      
      Caused a regression that needs investigating
      71036838
    • Tim Neutkens's avatar
      test: migrate webdriver callers to next.browser (#93941) · e860cec6
      Tim Neutkens authored
      ### What?
      
      Migrate remaining direct `next-webdriver` test callers that have a
      `NextInstance` to `next.browser()`, and expose the shared `Playwright`
      browser type from `e2e-utils`.
      
      ### Why?
      
      `NextInstance.browser` should be the supported browser-opening interface
      for test fixtures, with `next-webdriver` kept as the private
      implementation detail.
      
      ### How?
      
      Updated affected development, e2e, and production tests to call
      `next.browser()` directly, passing `baseUrl` where tests intentionally
      target a manually spawned or proxied server. Shared helpers now receive
      browser callbacks from the test context, and browser types import
      `Playwright` from `e2e-utils` instead of deriving from `next.browser` or
      importing from private paths.
      
      <!-- NEXT_JS_LLM_PR -->
      e860cec6
    • Jude Gao's avatar
      Add next-dev-loop and next-ppr-optimizer skills (#93943) · 2e753e23
      Jude Gao authored
      Two related skills for the `next dev` agentic workflow. They're paired:
      one establishes a shared session and view of the running app, and the
      other builds on it for a specific kind of work.
      
      **`next-dev-loop`** is the edit-then-verify rhythm during `next dev`.
      After making a change, the agent needs to know whether it actually works
      at runtime — not just whether it type-checks or compiles. The skill
      teaches the agent to use the two views Next.js exposes about itself:
      `/_next/mcp` (framework-side — routes, segments, RSC, server logs,
      errors) and `agent-browser` (browser-side — DOM, console, network, React
      fiber, vitals). The two views cross-check each other.
      
      The preflight is the load-bearing part. It opens a headed
      `agent-browser` session at the user's target URL with React DevTools
      enabled, then pauses — because the page might be behind a login wall or
      need specific state the user has to set up. Once the user confirms, the
      agent probes `/_next/mcp`, confirms Turbopack, and pulls the route map.
      Sibling skills can assume this setup is done.
      
      **`next-ppr-optimizer`** is the first sibling. It's the agentic loop for
      optimizing the static shell of a `cacheComponents` page: diagnose the
      shell, pick the highest-ROI refactor, apply it, confirm the shell grew.
      Two levers — push down (extract an I/O into a Suspense-wrapped child so
      the parent stays static; autonomous for trivial cases) or cache (wrap in
      `'use cache'` with a `cacheLife` profile chosen *with* the user — the
      skill never invents one). Diagnosis uses the suspense tree +
      `/__nextjs_original-stack-frames` for source resolution, with the H4
      anti-pattern guardrail (one dominant boundary covering the viewport is
      not a push-down candidate; recurse inside it instead).
      
      <!-- NEXT_JS_LLM_PR -->
      2e753e23
  3. 21 May, 2026 15 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.26 · fa2ec383
      next-js-bot[bot] authored
      fa2ec383
    • Benjamin Woodruff's avatar
      [ci] Set `TURBO_TASKS_AVAILABLE_PARALLELISM` to 4 in most e2e tests (#93996) · 88350cfe
      Benjamin Woodruff authored
      By default, turbo-tasks will try to use every available CPU core.
      
      While we do want it to use as many resources as possible if the CPU is
      otherwise idle, this may hurt us when the CPU is busy, as it will lead
      to more locking, more thread contention, more memory usage, etc.
      
      **This environment variable does not strictly limit Turbopack to using 4
      cores, it just restricts the number of main tokio worker threads and
      changes how we shard dashmaps.**
      
      We currently are using 16 core CI machines, but I want to experiment
      with 32 core build machines with a higher `TEST_CONCURRENCY`, and the
      per-core scaling of Turbopack was a concern that came up, as wall time
      improvements are sub-linear starting somewhere around 16 cores.
      
      
      ## Test Plan
      
      Watch CI, compare build times in this commit and the parent one.
      
      Attempt with a value of 2: https://github.com/vercel/next.js/pull/94001
      Attempt with a value of 8: https://github.com/vercel/next.js/pull/94002
      
      ![Screenshot 2026-05-20 at
      4.53.38 PM.png](https://app.graphite.com/user-attachments/assets/2e07db4a-068f-4344-863c-995877b254ce.png)
      
      I think this data is too noisy to draw any conclusions.
      88350cfe
    • Vercel Release Bot's avatar
      Update font data (#94006) · 90ae0ee0
      Vercel Release Bot authored
      This auto-generated PR updates font data with latest available
      Co-authored-by: 's avatarnext-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
      90ae0ee0
    • Andrew Clark's avatar
      Enable experimental.cachedNavigations by default with cacheComponents (#94012) · dd4058f0
      Andrew Clark authored
      Turns on `experimental.cachedNavigations` by default for projects
      already on `cacheComponents`. Last of the Sparkle stack.
      
      Tied to `cacheComponents` rather than flipped unconditionally because
      `cachedNavigations` is a no-op without it, and the existing validation
      already throws if you set it without `cacheComponents` — so an
      unconditional flip would break every non-Cache-Components project.
      
      <!-- NEXT_JS_LLM_PR -->
      dd4058f0
    • Andrew Clark's avatar
      Enable experimental.optimisticRouting by default (#94011) · 160a7bfc
      Andrew Clark authored
      Turns on `experimental.optimisticRouting` by default. Second of the
      Sparkle stack.
      
      A few tests pin `optimisticRouting: false` because their assertions
      observe the pre-flip navigation timing — search-params, a11y route
      announcer, and hash scroll. To be updated separately.
      
      <!-- NEXT_JS_LLM_PR -->
      160a7bfc
    • Andrew Clark's avatar
      Enable experimental.varyParams by default (#94010) · 01c81260
      Andrew Clark authored
      Turns on `experimental.varyParams` by default. First of a short stack
      flipping the remaining Sparkle flags to their new defaults — landing one
      flag at a time so any regressions are bisectable.
      
      A test in `segment-cache/prefetch-runtime` asserts on the pre-flip
      root-param cache-keying; pinned to `varyParams: false` until the test
      catches up.
      
      <!-- NEXT_JS_LLM_PR -->
      01c81260
    • Josh Story's avatar
    • Luke Sandberg's avatar
      Turbopack: don't crash the dev server when node_modules/next is briefly unresolvable (#93877) · ceff7268
      Luke Sandberg authored
      ### What?
      
      When `node_modules/next` is briefly unresolvable mid-session (for
      example because pnpm is mid-install of a package with a `next` peer
      dependency, reshuffling its symlinks) Turbopack would:
      
      - Emit a `MissingNextFolderIssue` with severity `Fatal`
      - Propagate `anyhow!("Next.js package not found")` through ~10 levels of
      the build graph
      - Surface the failure at the napi boundary as a
      `TurbopackInternalError`, which the Next.js JS-side treats as fatal and
      shuts the dev server down
      
      The reported user impact was a dev session that became wedged and could
      not recover even after restarting `next dev`, because the persistent
      cache had stored the failed operation state. Users reported it as
      "stuck", "catastrophic", and required wiping `.next/` to recover.
      
      Unfortunately while i was able to reproduce a number of bad outcomes, i
      couldn't actually reproduce the issue of `next dev` getting stuck in a
      bad state. Still this PR will improve a number of apis and error
      messages
      
      See internal discussion:
      https://vercel.slack.com/archives/C046HAU4H7F/p1778792876550309
      
      ### Why?
      
      A transient filesystem race during an install is the canonical
      recoverable error — once the install finishes, `next` is resolvable
      again. There is no reason this should bring down the dev server or
      poison the persistent cache.
      
      The bug had two contributing causes:
      
      1. The error message was poor. It assumed the only cause was a mis-set
      `turbopack.root`, with the entire message in `title()`. It didn't
      acknowledge the install-race case or any of the other realistic causes
      (broken symlink, monorepo hoisting, removed `node_modules/next`, global
      install). Users had no way to know that the right response was to wait
      or refresh.
      
      2. The Rust→napi boundary did not treat this as a recoverable error. Two
      specific code paths propagated `Err` instead of catching it:
      - `issue_filter_from_endpoint` in `endpoint.rs` calls
      `endpoint_op.connect().await?` — if the upstream endpoint resolution
      errors (as it does when `directory_tree_to_loader_tree` fails), this `?`
      propagates **before** the surrounding
      `strongly_consistent_catch_collectables` gets a chance to convert the
      failure into Issues.
      - `Project::hmr_version_state` is called bare from `project_hmr_events`
      at the napi boundary. There is no `_with_issues_operation` wrapper, so
      any error from the underlying
      `hmr_content`/`versioned_content_map.compute_entry` chain propagates
      straight to JS.
      
      ### How?
      
      Three changes:
      
      **1. Rewrite `MissingNextFolderIssue`**
      ([next_import_map.rs](crates/next-core/src/next_import_map.rs))
      - Severity downgraded from `Fatal` to `Error`. `Fatal` triggers an
      explicit JS-side server shutdown in `print-build-errors.ts`; `Error`
      lets the dev server recover.
      - Title is a single line: `"Could not find the Next.js package
      (next/package.json)"`.
      - Description lists all realistic causes (concurrent install,
      missing/broken symlink, mis-set workspace root, monorepo hoisting,
      global install).
      - Doc link moved to `documentation_link()` so it doesn't pollute the
      inline message.
      
      **2. Make `issue_filter_from_endpoint` Err-tolerant**
      ([endpoint.rs](crates/next-napi-bindings/src/next_api/endpoint.rs))
      - Wrap the `endpoint_op.connect().await` in a `match` and fall back to
      `IssueFilter::warnings_and_foreign_errors()` on `Err`.
      - This unblocks the existing `strongly_consistent_catch_collectables`
      recovery path, which then absorbs the upstream failure as Issues that
      surface through the napi boundary normally.
      
      **3. Add `hmr_version_state_with_issues_operation`**
      ([project.rs](crates/next-napi-bindings/src/next_api/project.rs))
      - Mirrors the existing `hmr_update_with_issues_operation` pattern.
      - Drives `hmr_version_operation` as an `OperationVc`, catches any `Err`
      and falls back to `NotFoundVersion`, and collects issues from the
      operation via `peek_issues`.
      - The napi `project_hmr_events` handler now uses this wrapper instead of
      calling `Project::hmr_version_state` bare. Issues from both
      `hmr_version_state` and `hmr_update` are merged before being sent to JS.
      - Required lifting the inner `hmr_version_operation` out of
      `Project::hmr_version_state`'s closure to make it callable from the napi
      layer.
      
      A new regression test at
      [test/development/app-dir/concurrent-install/](test/development/app-dir/concurrent-install/)
      reproduces the failure by moving `node_modules/next` aside
      mid-HMR-session and asserts that the dev server does not emit `FATAL: An
      unexpected Turbopack error occurred` or `TurbopackInternalError`, and
      that the friendly Issue text surfaces. The test is skipped under
      `NEXT_SKIP_ISOLATE=1` since that mode doesn't produce a manipulable
      `node_modules`.
      
      Out of scope: after recovery, the dev server still returns 500 on
      subsequent requests until the user manually refreshes (the JS-side
      per-route error state isn't invalidated by Turbopack's successful
      recompile). That's a separate dev-server caching issue.
      
      <!-- NEXT_JS_LLM_PR -->
      ceff7268
    • Niklas Mischkulnig's avatar
      55b2d3c7
    • Luke Sandberg's avatar
      [turbopack] Disable ctor under RA (#94022) · 493fba50
      Luke Sandberg authored
      Fix the `leftover tokens` issue we have been getting from rust-analyzer
      
      maybe?
      493fba50
    • Andrew Clark's avatar
      Respond to App Shell prefetches on the server (#93998) · bf529933
      Andrew Clark authored
      Introduces a new prefetch request type — the App Shell — and the
      server-side handler that renders it. With this PR, a client (or a test
      harness) can issue a request with `NEXT_ROUTER_PREFETCH_HEADER: '3'` and
      receive the param-independent shell of a route: param- and
      searchParam-bearing segments suspend, leaving everything that doesn't
      depend on them intact.
      
      The App Shell render is a subtype of the existing runtime prerender,
      distinguished by a single bit on the prerender store. When that bit is
      set, `await params` and `await searchParams` both hang forever, so any
      segment that depends on either suspends to its nearest fallback. The
      "shell" of the route is whatever renders above those suspense boundaries
      — layouts, cookie-derived UI, and other request-context-derived content.
      
      Static shell prefetches are not covered by these changes; those will be
      addressed by a future PR and use a slightly different strategy. (Instead
      of creating a new response type, the existing static prefetch response
      will be updated to support extraction of the shell via "rewinding",
      similar to what we do for cached navigations.)
      
      No client-side changes yet, only the server parts.
      <!-- NEXT_JS_LLM_PR -->
      bf529933
    • Hendrik Liebau's avatar
      Revert "Prerender HTTP access fallbacks with Cache Components semantics" (#94018) · 9741cb57
      Hendrik Liebau authored
      Reverts vercel/next.js#93988
      
      This broke not-found handling for internal Vercel apps.
      9741cb57
    • Tim Neutkens's avatar
      ci: run Linux Playwright jobs in prebuilt Microsoft container (#93794) · 1a1d1c97
      Tim Neutkens authored
      ## Summary
      
      Runs Linux `build_reusable.yml` jobs that need Playwright inside
      Microsoft's prebuilt
      [`mcr.microsoft.com/playwright:v1.58.2-noble`](https://mcr.microsoft.com/en-us/product/playwright/about)
      image. The image already contains Chromium, Firefox, WebKit, and their
      system dependencies under `/ms-playwright`, so Linux test shards no
      longer spend each job downloading browsers and installing apt deps.
      
      - Adds a `playwrightDockerImage` input, defaulting to the Ubuntu 24.04
      (`-noble`) Playwright image so glibc matches the `ubuntu-latest` runners
      that build `next-swc.linux-x64-gnu.node`.
      - Adds a `usePlaywrightContainer` input so jobs can opt out.
      `test-next-swc-wasm` opts out because its `afterBuild` step needs
      `rustup`, which is not in the Playwright image.
      - Skips `pnpm playwright install --with-deps` for Linux jobs running in
      the image; Windows jobs and opted-out jobs still install Playwright at
      runtime.
      - Enables the pnpm store cache inside container jobs because the
      container filesystem is ephemeral even when the host runner is
      persistent.
      
      ### Container condition
      
      The Playwright image is used when all of the following are true:
      
      - `inputs.needsPlaywright != 'no'`
      - `inputs.skipInstallBuild != 'yes'`
      - `inputs.usePlaywrightContainer != 'no'`
      - The runner is not Windows
      
      Otherwise `container.image` evaluates to `''` and the job runs directly
      on the runner.
      
      ### Compatibility fixes
      
      The Microsoft image is browser-focused, so this PR adds a few CI setup
      fixes before the existing test workflow runs:
      
      | Concern | Fix |
      | --- | --- |
      | Missing `jq` / `unzip` / native build toolchain | Install `jq`,
      `unzip`, and `build-essential` inside Linux container jobs. |
      | Firefox refuses `$HOME` not owned by the current user | Re-own GitHub
      Actions' mounted `/github/home` directory for the root user used by the
      job. |
      | Git sees the mounted workspace as dubious ownership | Mark
      `$GITHUB_WORKSPACE` as a safe directory for Git. |
      | Standalone tests bind to Docker's generated `HOSTNAME` | Set container
      `HOSTNAME=0.0.0.0`. |
      | `getStorageDirectory()` treats Docker storage as ephemeral | Add
      `NEXT_IGNORE_IS_DOCKER=1` for CI container jobs and honor it in
      `cache-dir.ts` so deterministic-build tests keep using `dist/cache`. |
      | `localhost` IPv4/IPv6 mismatch in analyze tests | Let the analyze
      server listen on both IPv4 and IPv6 localhost addresses. |
      | Nx fixture can race in CI before Next.js starts | Disable Nx isolated
      plugins for the `nx-handling` fixture scripts. |
      
      ## Timing
      
      Earlier comparison runs showed the Playwright install/setup portion
      across 82 matched Linux jobs dropping from about **3 h 03 m total** on
      canary to about **39 m 24 s total** with the containerized setup,
      roughly **1 m 45 s saved per job** on average. Test execution itself is
      excluded from that comparison because shard balancing makes it noisy.
      
      ## Test plan
      
      - [x] Latest PR CI run
      [`26121297957`](https://github.com/vercel/next.js/actions/runs/26121297957)
      completed successfully with 0 failed jobs.
      - [x] Linux Playwright matrices are green, including `test dev`, `test
      prod`, `test turbopack *`, `test cache components *`, `test node streams
      *`, and changed-test lanes.
      - [x] Linux non-Playwright jobs remain green on the bare runner,
      including `lint`, `types and precompiled`, `rust check`, `test cargo
      unit`, and `test unit`.
      - [x] `test-next-swc-wasm` is green while opted out of the container via
      `usePlaywrightContainer: 'no'`.
      - [x] Windows jobs are green and continue to use runtime Playwright
      installation.
      
      <!-- NEXT_JS_LLM_PR -->
      
      ---------
      Co-authored-by: 's avatarCursor <cursoragent@cursor.com>
      1a1d1c97
    • Hendrik Liebau's avatar
      Make `--debug-build-paths` work with `src/` directory projects (#94016) · 4023e48d
      Hendrik Liebau authored
      The `--debug-build-paths` option silently dropped routes in projects
      that keep their `app` or `pages` directory under `src/`. When a user
      passed `src/app/foo/page.tsx`, the glob matched the file but
      `categorizeAndAddPath` only recognized paths starting with `app/` or
      `pages/`, so nothing was added to the resolved app paths and the build
      produced no user routes. Conversely, when a user passed the bare
      `app/foo/page.tsx` form against a `src/app` project, glob found nothing
      and emitted `did not match any files`.
      
      `resolveBuildPaths` now detects whether `src/app` or `src/pages` exists
      and prepends `src/` to bare patterns before globbing, and
      `categorizeAndAddPath` strips a leading `src/` from matched files so
      route keys are normalized either way. Added a `src-dir` fixture and four
      tests covering explicit `src/` prefixes, bare patterns with
      auto-prefixing, and glob patterns through route groups.
      4023e48d
    • Benjamin Woodruff's avatar
      [ci] Add an `TURBO_TASKS_AVAILABLE_PARALLELISM` environment variable that… · 80cb3447
      Benjamin Woodruff authored
      [ci] Add an `TURBO_TASKS_AVAILABLE_PARALLELISM` environment variable that overrides `std::thread::available_parallelism` callsites (#93995)
      
      We want to use this to potentially improve efficiency in e2e tests where
      we're running many instances of Turbopack at once. By default,
      turbo-tasks will try to use every available CPU core.
      
      **This environment variable does not strictly limit Turbopack to using 4
      cores, it just restricts the number of main tokio worker threads and
      changes how we shard dashmaps.**
      
      This option will not make sense for the vast majority of users, it only
      makes sense when you are running *many* instances of Turbopack at once,
      and the exact semantics are potentially confusing, as it is not a hard
      limit.
      
      ## Test Plan
      
      Build vercel-site with this set to 1 and see a little over 100% CPU
      usage. Set it to 8 and see around 800% CPU usage.
      
      ```
      TURBO_TASKS_AVAILABLE_PARALLELISM=1 pnpm next build --experimental-build-mode=compile
      ```
      80cb3447
  4. 20 May, 2026 15 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.25 · 7c4b0525
      next-js-bot[bot] authored
      7c4b0525
    • Andrew Clark's avatar
      Add experimental.appShells feature flag (#93997) · 2ca99e1e
      Andrew Clark authored
      Plumbing for upcoming App Shell prefetching support: sets up the config
      field, the zod entry, and the build-time `process.env.__NEXT_APP_SHELLS`
      define. No behavior change in this PR — nothing reads the flag yet.
      Subsequent PRs in this sequence wire the server- and client-side work
      behind it.
      
      Enabling `experimental.appShells` requires several adjacent flags to
      also be enabled: `cacheComponents`, `experimental.prefetchInlining`,
      `experimental.varyParams`, `experimental.optimisticRouting`, and
      `experimental.cachedNavigations`. All of these are on track to become
      defaults soon, so there's no value in supporting App Shells against
      arbitrary subsets — the validation enforces that App Shells is tested in
      the configuration it will ship with. Each requirement drops out as the
      corresponding flag becomes a default.
      <!-- NEXT_JS_LLM_PR -->
      2ca99e1e
    • Hendrik Liebau's avatar
      Prerender HTTP access fallbacks with Cache Components semantics (#93988) · 5b6747ad
      Hendrik Liebau authored
      The body of `if (cacheComponents)` in `prerenderToStream` is extracted
      into a local helper, `prerenderWithCacheComponents(getPayload)`. The
      catch-block error paths now route through that helper whenever Cache
      Components is enabled, which means the legacy `prerender-legacy` store
      is no longer reachable from a Cache Components prerender.
      
      As a result, `notFound()`, `forbidden()`, and `unauthorized()` recovery
      renders the matching fallback boundary under `prerender` and
      `prerender-client` semantics. Dynamic API access in those boundaries —
      for example `useSearchParams()` without a surrounding `<Suspense>` — now
      surfaces as a blocking-route error instead of the legacy
      `BailoutToCSRError`.
      
      The dev side will be handled in a follow-up. The prerender handling
      diverged a bit from the dev rendering in #92231, and we'll likely need
      to re-align the dev rendering first.
      
      > [!TIP]
      > Best reviewed with hidden whitespace changes.
      5b6747ad
    • Hendrik Liebau's avatar
    • Will Binns-Smith's avatar
      @vercel/devlow-bench: 0.3.5 → 0.4.0 (#93951) · 3e97d89d
      Will Binns-Smith authored
      Version bump so we can publish the changes from #93950 (and the
      previously-unpublished 0.3.5 work) to npm.
      
      Stacked on top of #93950.
      
      <!-- NEXT_JS_LLM_PR -->
      3e97d89d
    • Will Binns-Smith's avatar
      devlow-bench: percentile-based comparison and run retries (#93950) · 56825e5d
      Will Binns-Smith authored
      A few changes to devlow-bench so the comparison output is easier to read
      and so a couple of flaky page-load runs don't quietly poison the stats.
      
      **compare**
      - Show p50 / p90 / p99 instead of mean / p50 / p90, with Δ p50 and a
      single Mann–Whitney p-value (Welch's t-test and Δ mean are gone — the
      mean was dragging on bad runs).
      - Hoist the modal sample count into an `n = 7 per metric` banner so only
      the outlier rows carry `(n)`.
      
      **runner**
      - Each attempt's measurements are buffered locally and only merged on
      success. Failed runs are retried (capped at 2× warmup+n) until we have a
      clean n samples.
      - Per-variant retry line plus an end-of-run summary noting which
      variants recovered and which fell short.
      
      **browser**
      - `hardNavigation` / `reload` now throw when the navigation response is
      missing or non-2xx. Previously a `200`-committed-but-broken page was
      being recorded as a real sample.
      
      The trigger was a run where 2 of 7 cold-build attempts hit an error
      page, dragging the mean response size from 45 MB to 33 MB while the p50
      was unchanged.
      
      <!-- NEXT_JS_LLM_PR -->
      56825e5d
    • Luke Sandberg's avatar
      use the action cache for passing tests (#93954) · 108e9652
      Luke Sandberg authored
      ## Summary
      
      Memoize passing tests across attempts of the same workflow run, so a
      re-attempt after a timeout or cancellation can skip what already passed.
      
      
      ## What changed
      
      - `run-tests.js` appends each passing test's filename to
      `$NEXT_TEST_PASSED_FILE` as it finishes (sync `write` + `fsync`, fd kept
      open across calls). On startup it reads the same file and skips any
      entries that match.
      - `build_reusable.yml` wraps the test step with `actions/cache/restore`
      (before) and `actions/cache/save` (after, with `if: always()`). The save
      step runs on success, failure, and cancel — which is the whole point: a
      cancelled attempt still gets to preserve its progress for retry.
      - Cache key is scoped to
      `${input_step_key}-${run_id}-attempt${run_attempt}`, with `restore-keys`
      falling back to any earlier attempt of the same run.
      
      The previous implementation wrote a single Turbo-remote-cache blob
      *after* `Promise.allSettled` resolved — so a cancellation (like [run
      26127371192](https://github.com/vercel/next.js/actions/runs/26127371192/job/76845288867))
      lost every passed test from that attempt.
      
      This also removes one dependency on the turbo-remote cache (there are
      still two more uses of `scripts/turbo-cache.mjs`)
      
      <!-- NEXT_JS_LLM_PR -->
      108e9652
    • Niklas Mischkulnig's avatar
      Turbopack: respect the module-sync export condition (#93970) · 6e894d05
      Niklas Mischkulnig authored
      I set it to `::Unknown` because we the runtime may or may not support
      module-sync. So let's just trace both for now
      
      
      
      There is one problem though:
      
      
      https://nodejs.org/docs/latest-v26.x/api/packages.html#conditional-exports
      > "module-sync" - matches no matter the package is loaded via import,
      import() or require(). The format is expected to be ES modules that does
      not contain top-level await in its module graph - if it does,
      ERR_REQUIRE_ASYNC_MODULE will be thrown when the module is require()-ed.
      
      So we have multiple options:
      1. We definitely want to respect module-sync for tracing. We don't
      really have to throw ERR_REQUIRE_ASYNC_MODULE here, Node.js will do it
      at runtime anyway.
      2. ~~What about bundling? Either~~
      - ~~Respect module-sync always, but don't throw
      ERR_REQUIRE_ASYNC_MODULE.~~
      - ~~Respect module-sync always, and do throw a build error the module
      requires TLA. This would require a separate validation pass though.~~
         - I'm not enabling it for bundling for now
      6e894d05
    • Tim Neutkens's avatar
      Add backport PR skill (#93973) · f172ba9c
      Tim Neutkens authored
      ### What?
      
      Adds a new `$backport-pr` skill for backporting merged PRs from `canary`
      to release branches.
      
      ### Why?
      
      Backports follow a repeatable workflow: branch from the release branch,
      cherry-pick the merged PR commit, verify, then open a PR against that
      release branch. Capturing it as a skill helps Codex do that
      consistently.
      
      ### How?
      
      Adds `.agents/skills/backport-pr/SKILL.md` with inputs, git workflow,
      verification guidance, and the backport PR body shape. Adds a one-line
      reference in `AGENTS.md`.
      
      ### Verification
      
      - `python3
      /Users/timneutkens/.codex/skills/.system/skill-creator/scripts/quick_validate.py
      .agents/skills/backport-pr`
      - `pnpm prettier --with-node-modules --ignore-path .prettierignore
      --write AGENTS.md .agents/skills/backport-pr/SKILL.md`
      - `git diff --cached --check`
      
      <!-- NEXT_JS_LLM_PR -->
      f172ba9c
    • Luke Sandberg's avatar
      turbo-tasks: task-storage memory wins (#93720) · 05553796
      Luke Sandberg authored
      ## Summary
      
      Four small, independent changes that shrink `TaskStorage` and the data
      it owns:
      
      Recommend reviewing commit-by-commit
      
      1. **`Arc<CachedTaskType>` → `triomphe::Arc<CachedTaskType>`.**
      `triomphe::Arc` is already a workspace dep used in `ReadRef` /
      `SharedReference`. `CachedTaskType` never appears in a `Weak<...>`, so
      we can drop the weak count and the CAS in `drop_slow`. Saves one `usize`
      per allocation. Migrated via a `CachedTaskTypeArc` newtype so the
      bincode `Encode`/`Decode` impls don't need to cross the orphan rule.
      
      2. **Niche-encode `CellDependency`.** The `cell_dependencies` /
      `cell_dependents` sets used to hold `(CellRef, Option<u64>)` tuples —
      `Option<u64>` cost a full 16 B (8 B discriminant + 8 B value, aligned),
      making each element 32 B. A `CellDependency` enum with two variants
      (`All(CellRef)` / `Hash(CellRef, u64)`) lets the layout algorithm reuse
      the niche on `ValueTypeId` (`NonZero<u16>`) inside
      `CellRef.cell.type_id` for the variant tag. Element size drops 32 → 24
      B; `LazyField` from 56 → 48 B. The same enum backs both forward and
      reverse edges — for `cell_dependents` we re-point `CellRef.task` at the
      dependent task.
      
      Added `CellDependency::into_parts()` and use it in
      `iter_cell_dependents` / `iter_cell_dependencies` hot loops so the
      discriminant is checked once instead of twice via back-to-back
      `cell_ref()` + `key()` calls.
      
      3. **`TaskStorage::lazy: Vec<LazyField>` → `TinyVec<LazyField>`.** The
      lazy vec only ever holds ~25 elements (one per declared lazy field in
      the schema). Swapping `Vec`'s 24 B `(ptr, len, cap)` header for `(ptr,
      len: u8, cap: u8)` + 6 B padding gives 16 B. Drops
      `size_of::<TaskStorage>()` from 136 → 128 B.
      
      `TinyVec` is hand-rolled so I added a push/iter micro-benchmark to
      confirm it doesn't lose performance vs std `Vec`. Results below.
      
      4. **Rightsize collections** → Explore the `AutoSet`/`AutoMap` types in
      storage_schema and ensure each one is maximally sized for its natural
      alignment.
      
      
      ## Benchmark results
      
      ### `next build` on a representative app (15 runs each, M4 Pro,
      `caffeinate -dimsu nice -n -20`)
      
      Fresh same-day baseline against branch:
      
      | metric | canary | branch | Δ | 95% CI | significant? |
      |---|---:|---:|---:|---|:---:|
      | wall time | 40.83s | 41.12s | +0.7% | [−1.07s, +1.64s] | no |
      | user time | 282.27s | 283.21s | +0.3% | [−1.02s, +2.89s] | no |
      | sys time | 69.38s | 71.26s | +2.7% | [−1.54s, +5.32s] | no |
      | **MaxRSS** | **12.47 GB** | **12.04 GB** | **−3.4%** | **[−0.48 GB,
      −0.38 GB]** | **yes** |
      
      **MaxRSS is the headline.** −0.43 GB on a 12.5 GB working set, with
      t=−17.86 (every branch run lower than every canary run, CV ≤ 0.6% on
      both sides). Wall / user / sys are all within noise — this PR is a
      memory win with no measurable timing impact.
      
      ### `TinyVec` vs `Vec` micro-bench (`turbo-tasks/benches/tiny_vec.rs`,
      200 samples each)
      
      | n | Vec push | TinyVec push | Δ% | Vec iter | TinyVec iter | Δ% |
      |---:|---:|---:|---:|---:|---:|---:|
      | 0 | 1.31ns | 894ps | **−31.8%** | 598ps | 596ps | −0.4% |
      | 1 | 16.92ns | 14.75ns | **−12.9%** | 964ps | 952ps | −1.2% |
      | 4 | 17.93ns | 15.93ns | **−11.1%** | 1.49ns | 1.50ns | +0.5% |
      | 8 | 63.13ns | 45.24ns | **−28.3%** | 1.97ns | 1.96ns | −0.2% |
      | 16 | 97.35ns | 79.91ns | **−17.9%** | 3.16ns | 3.14ns | −0.5% |
      | 24 | 137.41ns | 119.88ns | **−12.8%** | 4.30ns | 4.30ns | +0.0% |
      
      TinyVec push is 11–32% faster than Vec push across all realistic sizes;
      iter is identical. Run with `cargo bench -p turbo-tasks --bench
      tiny_vec`.
      
      ### `task_overhead/turbo` Criterion bench (M4 Pro, `--sample-size 200`)
      
      | variant | dur | canary | branch | Δ | significant? |
      |---|---:|---:|---:|---:|:---:|
      | turbo-uncached | 1µs | 9.77 µs | 9.68 µs | −1.0% | yes |
      | turbo-uncached | 1000µs | 1.01 ms | 1.01 ms | −0.1% | yes |
      | turbo-cached-same-keys | 1µs | 198.6 ns | 191.9 ns | −3.4% | yes |
      | turbo-cached-same-keys | 100µs | 226.5 ns | 208.1 ns | −8.1% | yes |
      | turbo-cached-different-keys | 1µs | 233.8 ns | 224.1 ns | −4.2% | yes
      |
      | turbo-cached-different-keys | 100µs | 305.3 ns | 246.9 ns | −19.1% |
      yes |
      | turbo-uncached-parallel | 10µs | 1.63 µs | 1.54 µs | −5.8% | yes |
      | turbo-uncached-parallel | 100µs | 8.41 µs | 7.88 µs | −6.3% | yes |
      
      
      <!-- NEXT_JS_LLM_PR -->
      05553796
    • Aurora Scharff's avatar
      fix(devtools): detect VS Code renamed macOS binary in launch-editor (#93971) · dadc154d
      Aurora Scharff authored
      ### What?
      
      Add the new VS Code macOS binary name (`Code`) to the
      `COMMON_EDITORS_MACOS` detection map in `launch-editor.ts`, alongside
      the legacy `Electron` entry. Same for VS Code Insiders (`Code -
      Insiders`).
      
      ### Why?
      
      VS Code renamed its macOS binary from `Electron` to `Code`. The
      `guessEditor()` function detects running editors by matching `ps x`
      output against known process paths. Since the old key
      (`…/MacOS/Electron`) no longer appears in the process list, VS Code is
      not detected — the "open in editor" button silently does nothing.
      
      ### How?
      
      Added two new entries to `COMMON_EDITORS_MACOS` that map the renamed
      binaries to the same `code` CLI path. The old entries are kept for
      backward compatibility.
      
      <!-- NEXT_JS_LLM_PR -->
      dadc154d
    • Tim Neutkens's avatar
      Add deployable tarballs to pack-next (#93963) · cdd77ac4
      Tim Neutkens authored
      ### What?
      
      Adds a `--deployable-tar` option to `pack-next` that writes generated
      tarballs into the target project and patches package references to use
      relative `file:` paths.
      
      ### Why?
      
      Projects that need to deploy with locally packed Next.js packages should
      be able to include those tarballs inside the project directory instead
      of referencing tarballs from the Next.js checkout.
      
      ### How?
      
      Resolves the target project package.json location, writes tarballs to a
      sibling `tarballs/` directory, and maps package override paths to
      project-relative references when patching package.json. Existing `--tar`
      behavior continues to write to the repository tarballs directory.
      
      ### Verification
      
      - `git diff --check`
      - `git diff --cached --check`
      - `pnpm prettier --with-node-modules --ignore-path .prettierignore
      --write scripts/pack-next.ts scripts/pack-utils/patch-package-json.ts
      contributing/core/testing.md contributing/core/developing.md`
      - `npx eslint --config eslint.config.mjs --fix scripts/pack-next.ts
      scripts/pack-utils/patch-package-json.ts contributing/core/testing.md
      contributing/core/developing.md` (Markdown files were ignored because no
      matching ESLint config was supplied)
      - `pnpm pack-next --project ../sandbox/nextjs-duplicated-html-repro/
      --deployable-tar`
      
      <!-- NEXT_JS_LLM_PR -->
      cdd77ac4
    • Aurora Scharff's avatar
      Polish instant fix cards and validation messages (#93894) · 4e3eb513
      Aurora Scharff authored
      ### What?
      
      - Rename cards to plain English: `Prerender params if known`, `Mark the
      route as dynamic`, `For telemetry, use a timing API`.
      - Remove `Wrap body in Suspense` card from viewport variants.
      - Body errors: `during the initial render` → `during prerendering`;
      `blocking navigation` → `blocking the page load`.
      - Server sync IO leads with `the unstable value <expression>`.
      - Client sync IO drops `fixed at build time`.
      - New loading-state icon for the `block` group.
      
      ### Demo
      
      - [Fix
      Overview](https://error-messages-overhaul-ibsl.labs.vercel.dev/fix-overview)
      
      <!-- NEXT_JS_LLM_PR -->
      
      ---------
      Co-authored-by: 's avatarCursor <cursoragent@cursor.com>
      4e3eb513
    • Niklas Mischkulnig's avatar
      Fix Yarn berry tests (#93962) · d13adce3
      Niklas Mischkulnig authored
      4.15 made [npmMinimalAgeGate: 1d the
      default](https://github.com/yarnpkg/berry/pull/7135)
      
      1. Pin yarn version to prevent random breakages in the future
      2. Add trusted packages to ignore npmMinimalAgeGate for them
      
      https://github.com/yarnpkg/berry/releases/tag/%40yarnpkg%2Fcli%2F4.15.0
      d13adce3
    • Niklas Mischkulnig's avatar