1. 04 Aug, 2026 18 commits
    • next-js-bot[bot]'s avatar
      v16.3.1-canary.2 · b4f5f854
      next-js-bot[bot] authored
      b4f5f854
    • Sam Poder's avatar
      [turbopack] Add test for sideEffects with optimizePackageImports (#96549) · bc28b2d9
      Sam Poder authored
      Follow up to https://github.com/vercel/next.js/pull/96383. This test
      passes with Webpack, failed with Turbopack before the change, and passes
      now.
      bc28b2d9
    • Luke Sandberg's avatar
      [turbopack] Strip leading BOM before parsing CSS (#96678) · ff3a2cfa
      Luke Sandberg authored
      Fork PR #96379 by @lazerg, re-opened as a branch PR so the "when
      deployed" CI jobs can run — those require Vercel deployment secrets that
      GitHub does not expose to pull requests from forks, so they can never
      pass on the original.
      
      **The fix commits are unchanged and still authored by @lazerg.** This PR
      only adds tests on top. Please credit them; #96379 should be closed in
      favor of this one.
      
      ### What?
      
      A CSS file beginning with a UTF-8 BOM (`EF BB BF`) is mishandled by
      Turbopack. Lightning CSS does not skip the BOM, so it is tokenized as
      content and the first token is misparsed:
      
      ```
      ./app/bom.css:1:2
      Error: Parsing CSS source code failed
      Unexpected token AtKeyword("layer")
      ```
      
      The user-visible symptom is broader than a failed build. Turbopack
      parses with `error_recovery: true`, and under that setting a leading BOM
      makes Lightning CSS return `Ok` with **zero rules** — so a BOM-prefixed
      stylesheet could silently drop all of its styles instead of erroring.
      dart-sass (compressed style) and PostCSS >= 8.5.24 both emit or
      round-trip such a BOM, so real projects hit this.
      
      Fixes #96374
      
      ### How?
      
      Strip a leading `U+FEFF` in `parse_css_stylesheet` before handing the
      source to Lightning CSS, covering both `StyleSheet::parse` call sites
      while leaving `ParseCssResult.code` as the original bytes that code
      frames are rendered from.
      
      That split makes parser positions relative to the stripped copy while
      code frames still render the original line, so first-line positions need
      compensating. `source_pos_for_loc` adds the stripped character back for
      line 0 of BOM files. Only line 0 is affected, because the BOM contains
      no newline.
      
      ### Tests
      
      `test/e2e/app-dir/css-bom` — a BOM-prefixed stylesheet compiles and its
      rules reach the page. Verified failing without the fix with the exact
      error above, and passing with it, in dev-turbo, start-turbo and
      start-webpack.
      
      `test/development/app-dir/css-bom-code-frame` — covers the position
      correction. Two fixtures hold the same invalid `@media (min-width: {})`
      on line 1 and differ only by the leading BOM; the test asserts the BOM
      file's reported column is exactly one greater:
      
      | | `no-bom` | `bom` | |
      |---|---|---|---|
      | without `source_pos_for_loc` | 18 | 18 | fails |
      | with it | 18 | 19 | passes |
      
      Asserting the relationship rather than a literal column keeps this
      robust if Lightning CSS changes its absolute column convention. It is
      kept separate from the e2e suite because the fixtures are intentionally
      invalid CSS, and scoped to Turbopack in dev, where the warning reaches
      the CLI as the page is requested.
      
      ---------
      Co-authored-by: 's avatarlazerg <lazerg2@gmail.com>
      Co-authored-by: 's avatarvercel-gh-bot-3[bot] <282332853+vercel-gh-bot-3[bot]@users.noreply.github.com>
      ff3a2cfa
    • Vercel Release Bot's avatar
    • Joseph's avatar
      docs: use relative doc links in instant-navigation error pages (#96672) · 44c3ec6b
      Joseph authored
      These links no longer need to point to preview.
      44c3ec6b
    • Marcos Hernanz's avatar
      Turbopack: terminate failed plugin worker threads (#96592) · 39b7da2e
      Marcos Hernanz authored
      ## What
      
      Terminate a worker-thread plugin runtime when an evaluation or IPC error
      marks
      its `WorkerOperation` non-reusable.
      
      `disallow_reuse()` already removed the worker from pool statistics and
      disabled
      the callback that returns it to the pool, but it did not stop the
      underlying
      Node.js `Worker`. The worker then stayed strongly owned by
      `loaderWorkers`, kept
      its V8 isolate/module graph alive, and waited forever for another task
      that
      could never arrive.
      
      This calls the existing worker terminator used by `wait_or_kill`,
      scale-down,
      and scale-to-zero. It removes the routed native channel and dispatches
      the
      existing JavaScript `Worker.terminate()` callback, which also deletes
      the map
      entry.
      
      ## Why this matters for v0
      
      v0's planned worker-thread runtime turns transient loader/PostCSS errors
      during
      agent edits into a deterministic lifecycle leak. On the real v0
      `/button`
      route, each unique Tailwind/PostCSS failure retained one complete worker
      runtime
      on the baseline.
      
      The balanced eight-process A/B panel (80 unique failures per lane)
      measured:
      
      | Lane | `WorkerThread` slope | Private-memory slope | Median failure |
      Median recovery | >5 s failures |
      |---|---:|---:|---:|---:|---:|
      | baseline | **+1.000/error** | **+49.81 MiB/error** | 108.04 ms |
      329.26 ms | 3 / 80 |
      | candidate | **0.000/error** | **+5.12 MiB/error** | 108.15 ms | 317.65
      ms | 2 / 80 |
      
      That is a **100% elimination of leaked-worker growth** and an **89.7%
      reduction
      in retained private-memory slope** (exact process-bootstrap 95%
      interval:
      85.7%–99.5%). Every candidate process was below every baseline process;
      exact
      4-vs-4 process-label permutation `p=0.0143` one-sided / `0.0286`
      two-sided.
      Median failure latency changed by only +0.11 ms.
      
      The independent 100-cycle-per-lane endurance confirmation showed the
      same
      causal result:
      
      | Lane | `WorkerThread` cycle 1→100 | Private memory cycle 1→100 |
      Private slope | Median failure | Median recovery |
      |---|---:|---:|---:|---:|---:|
      | baseline | **38→137** | **4.28→7.34 GiB** | **+27.02 MiB/error** |
      104.45 ms | 331.32 ms |
      | candidate | **32→32** | **3.93→4.10 GiB** | **+0.98 MiB/error** |
      102.94 ms | 297.24 ms |
      
      That long run eliminated all observed worker growth and reduced the
      fitted
      private-memory slope 96.4%. Every one of the 200 unique failures
      recovered to
      the complete real route, and the source hash was restored after every
      cycle.
      
      The benchmark used fresh `.next` state per process, five error/recovery
      warmups,
      a five-minute quiescence window, unique uncached errors, exact source
      restoration
      after every cycle, and within-process slopes. Baseline and candidate
      native
      binaries were built from the same Next.js base, with only this lifecycle
      change
      affecting candidate native code, and selected by SHA-verified
      `NEXT_TEST_NATIVE_DIR` paths.
      
      This is independent of #96433. That PR coordinates explicit multi-file
      edit
      transactions; this PR fixes the lifecycle of a worker that has already
      failed.
      It also does not change idle-worker scale-down policy: failed workers
      are absent
      from the idle pool, so scale-down cannot see them.
      
      ## Regression test
      
      The new development test schedules a one-second filesystem marker inside
      a
      custom loader, then throws an evaluation error under
      `turbopackPluginRuntimeStrategy: 'workerThreads'`:
      
      - baseline native binary: fails because the orphan worker remains alive
      and
        writes the marker;
      - candidate native binary: passes because the worker is actually
      terminated;
      - candidate then renders a recovered value, proving replacement/recovery
      works.
      
      ## Validation
      
      - `pnpm build-all`
      - `cargo fmt --all -- --check`
      - `cargo check -p turbopack-node --all-targets`
      - `cargo test -p turbopack-node --lib`
      - `cargo clippy -p turbopack-node --all-targets -- -D warnings`
      - focused Prettier and ESLint checks for the new test
      - candidate integration test pass; exact baseline integration test fails
      at the
        intended liveness assertion
      - GPT-5.6 Sol xhigh + Claude Opus 5 xhigh autoreview panel: zero
      actionable
        findings, patch correct at 0.96 confidence
      
      Exact optimized native SHA-256 values used by the benchmark:
      
      - baseline:
      `609eeeed41e1425f06136b54b7997e5b1b1add992169b17a797889dfb830dd7f`
      - candidate:
      `141211112ae47b8bd814aaab437060114e92f60a1bf6f23e1b0e153b1e4837cc`
      
      Both stripped binaries were 205,863,784 bytes. Raw per-process JSON,
      `/proc`
      samples, server logs, harness source, analysis output, and A/B plus
      endurance
      graphs are retained in the investigation archive.
      Co-authored-by: 's avatarvercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
      39b7da2e
    • Sam Poder's avatar
    • Zack Tanner's avatar
      Fix HTML-limited bot matching in prerender bypass rules (#96584) · d87a203b
      Zack Tanner authored
      ## Summary
      
      - preserve `htmlLimitedBots` substring semantics when generating the PPR
      cache-bypass user-agent rule
      - allow surrounding user-agent text so bots such as `googleweblight`
      correctly bypass the prerender shell
      - add deployment coverage confirming blocking metadata for bot
      identifiers embedded in full user-agent strings, including custom
      `htmlLimitedBots` patterns
      
      <!-- NEXT_JS_LLM -->
      d87a203b
    • Luke Sandberg's avatar
      [ci] Fix create_release_branch for new repo permissions (#96641) · fca0fea5
      Luke Sandberg authored
      ### What
      
      Fixes the **Create Release Branch** workflow, which currently fails on
      every run.
      
      1. Drop `permission-environments: write` from the GitHub App token
      request.
      - The release App installation no longer grants it, and
      `actions/create-github-app-token` fails hard on an ungranted permission.
      2. Drop the runtime `deployment-branch-policies` API call (and its 5s
      sleep) from `scripts/create-release-branch.js`.
      - No longer needed: the `release-stable` environment now statically
      allows branches conforming to `next-NN` / `next-NN-*`. This is what the
      permission above existed for.
      3. Create the setup commit as a GitHub-signed commit via
      `scripts/github-utils/signed-commit.js` instead of `git push`.
      - Branch protection requires signed commits; `git push` pushed an
      unsigned one. Uses the same `createSignedCommit` + `upsertBranchRef`
      pattern as `scripts/automated-update-workflow.js`.
      
      ### Why
      
      The most recent run
      ([30923742579](https://github.com/vercel/next.js/actions/runs/30923742579/job/92040655448))
      dies at the first step, `Create GitHub App token`, with a 422 — so the
      job never even clones the repo.
      
      ### Note for review
      
      Release tags are **annotated** tag objects, so `git rev-parse v16.0.0`
      returns the tag object SHA, not the commit. `createSignedCommit` passes
      `baseSha` straight into `parents: [...]`, so the base is dereferenced
      with `^{commit}`. Its internal `^{tree}` lookup happens to resolve
      either way, so this would otherwise only have failed at commit-creation
      time during a real release.
      
      The static patterns cover `next-16-2`-style names but not a single-digit
      major like `next-9-5`. Not a concern for current or future releases, but
      noting it since the previous code created the policy for any branch
      name.
      
      ### Verification
      
      The workflow is `workflow_dispatch`-only and writes to the real repo, so
      it can't be run end-to-end from a PR. Verified locally against the real
      `v16.0.0` tag in a throwaway clone:
      
      - `git reset --hard v16.0.0` leaves HEAD exactly at `v16.0.0^{commit}`,
      confirming the base SHA is right.
      - Replaying the lerna.json / `build_and_deploy.yml` /
      `build_and_test.yml` mutations produces exactly those 3 changed files
      and nothing else.
      - Driving `createTreeFromLocalCommit` with a mocked `request` (no
      network) uploads 3 blobs with correct `100644` modes and a `base_tree`
      that matches the tag's tree.
      - `node --check`, prettier, and eslint all clean.
      
      Still needs a real `workflow_dispatch` run after merge to confirm the
      token step succeeds and the resulting commit shows as **Verified**.
      fca0fea5
    • Niklas Mischkulnig's avatar
      test: skip action module instance deploy test (#96629) · 47939786
      Niklas Mischkulnig authored
      There might be multiple function instances with their own
      app/shared/action.js and thus multiple instances of the counter.
      47939786
    • Joseph's avatar
      docs: quote the dynamicParams build error in a blockquote (#96633) · 4fdca028
      Joseph authored
      Fix visual error on migration for dynamicParams
      4fdca028
    • next-js-bot[bot]'s avatar
      v16.3.1-canary.1 · 96de959c
      next-js-bot[bot] authored
      96de959c
    • Joseph's avatar
      docs: correction to dynamicParams migration (#96624) · 368c154a
      Joseph authored
      `dynamicParams` is not supported in Cache Components
      368c154a
    • Joseph's avatar
      docs: proxy event argument (#96435) · 62e294e8
      Joseph authored
      The event parameter (second position) passed to proxy was not documented
      in the Params section
      
      <!-- Thanks for opening a PR! Your contribution is much appreciated.
      To make sure your PR is handled as smoothly as possible we request that
      you follow the checklist sections below.
      Choose the right checklist for the change(s) that you're making:
      
      ## For Contributors
      
      We encourage you to use AI to assist you in researching, creating, and
      reviewing changes. However, you must review and deeply understand the
      contributions you are making. For this reason, **pull request
      descriptions from external contributors must be written by a human**.
      
      ### Improving Documentation
      
      - Run `pnpm prettier-fix` to fix formatting issues before opening the
      PR.
      - Read the Docs Contribution Guide to ensure your contribution follows
      the docs guidelines:
      https://nextjs.org/docs/community/contribution-guide
      
      ### Fixing a bug
      
      - Related issues linked using `fixes #number`
      - Tests added. See:
      https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
      - Errors have a helpful link attached, see
      https://github.com/vercel/next.js/blob/canary/contributing.md
      
      ### Adding a feature
      
      - Implements an existing feature request or RFC. Make sure the feature
      request has been accepted for implementation before opening a PR. (A
      discussion must be opened, see
      https://github.com/vercel/next.js/discussions/new?category=ideas)
      - Related issues/discussions are linked using `fixes #number`
      - e2e tests added
      (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
      - Documentation added
      - Telemetry added. In case of a feature if it's used or not.
      - Errors have a helpful link attached, see
      https://github.com/vercel/next.js/blob/canary/contributing.md
      
      ### Signed commits
      
      - This repository requires verified commit signatures on protected
      branches.
      - If this pull request is blocked for unsigned commits, re-sign the
      commits and force-push the branch.
      - A `Signed-off-by` line in the commit message is not enough.
      
      ## For Maintainers
      
      - Minimal description (aim for explaining to someone not on the team to
      understand the PR)
      - When linking to a Slack thread, you might want to share details of the
      conclusion
      - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
      - Add review comments if necessary to explain to the reviewer the logic
      behind a change
      
      ### What?
      
      ### Why?
      
      ### How?
      
      Closes NEXT-
      Fixes #
      
      -->
      62e294e8
    • Joseph's avatar
      docs: remove experimental note from runtime prefetching (#96615) · 3c762c7f
      Joseph authored
      Runtime prefetching no longer needs this label.
      3c762c7f
    • Luke Sandberg's avatar
      Turbopack: don't strip async-module runtime from shared runtime chunks (#96599) · a75ece16
      Luke Sandberg authored
      ### What?
      
      Turbopack could emit a `[turbopack]_runtime.js` without the async-module
      (top-level await) machinery while chunks written next to it call
      `__turbopack_context__.a(...)`, failing production builds with
      `TypeError: __turbopack_context__.a is not a function`.
      
      Reported against 16.3 when loading a `postcss.config.js`. Intermittent,
      production only.
      
      ### Why?
      
      The runtime chunk is emitted to a fixed path, so every module graph
      using a chunking context writes the same file. Since #94376 the
      async-module machinery is dropped when a graph has no async modules —
      but that's decided per graph.
      
      The Next.js node execution context is shared by every build-time JS
      evaluation (postcss configs, webpack loaders, `next/font/google`), each
      with its own `ModuleGraph`. A graph with no async modules emits a
      runtime without `.a` and clobbers the variant the postcss loader needs.
      The winner is `assets.first()` in `emit_assets`, which depends on
      emission order — hence the intermittency.
      
      ### How?
      
      Add `shared_runtime_chunk` to the chunking contexts and set it where one
      runtime is shared by several graphs, so those always emit the complete
      runtime. This matches the carve-out that already exists for development:
      in both cases a single graph can't see everything sharing the runtime.
      Whole-app server contexts keep the optimization.
      
      The browser side tested `RuntimeType::Development` as a proxy for
      per-page graphs, which only works because `per_page_module_graph`
      currently *is* `mode == Development`. It now reads the real flag.
      
      Also renames `has_async_modules` to `include_async_module_runtime`,
      since it's now true whenever we can't tell.
      
      I audited the rest of `.next/build/` for the same hazard: the runtime
      chunk (and its `.map`) was the only fixed-path output. Everything else
      is content-hashed via `AssetIdent::output_name`.
      
      ### Testing
      
      `test/production/app-dir/turbopack-shared-runtime-async-module` uses a
      single synchronous loader — enough on its own to produce the stripped
      runtime. Verified to fail without the fix and pass with it. `cargo test
      -p turbopack-tests` passes with no snapshot churn.
      
      Follow-up, not in this PR: the conflict is silent. `EmitConflictIssue`
      is `IssueSeverity::Error` but never fired here, because the two runtimes
      weren't grouped into one `emit_assets` call.
      a75ece16
    • Sam Poder's avatar
      [turbopack] Add `turbopack_ecmascript` and `turbopack_wasm`'s embeded FS to… · 1ba63dfa
      Sam Poder authored
      [turbopack] Add `turbopack_ecmascript` and `turbopack_wasm`'s embeded FS to `internal_assets_conditions` (#96600)
      
      Closes https://github.com/vercel/next.js/issues/96597; we were wrongly
      applying the user-defined transforms to our internal web worker loaders
      which caused this bug.
      
      This is a regression caused by
      https://github.com/vercel/next.js/pull/94372.
      1ba63dfa
    • Zack Tanner's avatar
      Preserve per-segment prefetching after dynamic navigation (#96583) · 4be2ee74
      Zack Tanner authored
      ## Summary
      
      Cache Components routes support per-segment prefetching, but dynamic
      Flight responses only advertised this capability during static
      generation. This could cause a subsequent `router.prefetch()` call to
      fall back to loading-boundary prefetching and issue an unnecessary
      request.
      
      In other words, this logic was correctly determined
      [here](https://github.com/vercel/next.js/blob/0db9e5f994ddf144bef72640d5be9bb17d77fe30/packages/next/src/server/app-render/app-render.tsx#L2204)
      but not in the initial payload.
      
      ## Verification
      
      - `pnpm test-start-turbo
      test/e2e/app-dir/segment-cache/basic/segment-cache-basic.test.ts`
      - `pnpm test-start-webpack
      test/e2e/app-dir/segment-cache/basic/segment-cache-basic.test.ts`
      4be2ee74
  2. 03 Aug, 2026 22 commits
    • Zack Tanner's avatar
      Rename static generation stream option to waitForAllReady (#96564) · 0db9e5f9
      Zack Tanner authored
      ## Summary
      
      - rename the `isStaticGeneration` stream option to `waitForAllReady`
      - derive the value once from `supportsDynamicResponse` and reuse it
      across render paths
      - clarify that the option controls waiting for React’s `allReady`,
      rather than representing the broader static-generation mode
      
      Stacked on #96563.
      0db9e5f9
    • Zack Tanner's avatar
      Remove obsolete static generation plumbing (#96563) · 7de651e8
      Zack Tanner authored
      ## Summary
      
      - Removes the unused `RenderOptsPartial.isStaticGeneration` option and
      its debug-render write. `WorkStore` derives this value independently.
      - Removes `shouldGenerateStaticFlightData` and its redundant guards.
      These checks only occur inside `prerenderToStream`, which is exclusively
      entered when `isStaticGeneration` is true.
      
      <!-- NEXT_JS_LLM -->
      7de651e8
    • Sam Poder's avatar
      [turbopack] Drop dead writes to `exports` (#96381) · 8231b031
      Sam Poder authored
      Drops the dead writes that begun being ignored in
      https://github.com/vercel/next.js/pull/96380
      8231b031
    • Sam Poder's avatar
      [turbopack] Ignore writes to `exports` after a `module.exports = {}` writes (#96380) · 1dd15c50
      Sam Poder authored
      Take this example:
      
      ```javascript
      // Discarded by the literal below, so not an export.
      exports.early = 'early-value'
      
      module.exports = {
        used: 'used-value',
        unused: 'unused-value',
      }
      
      // Not exports: `exports` and top-level `this` hold the object the literal discarded.
      exports.deadExports = 'dead-exports'
      this.deadThis = 'dead-this'
      Object.defineProperty(exports, 'deadDefined', { value: 'dead-defined' })
      
      // Exports: `module.exports` is the live object.
      module.exports.usedLate = 'used-late'
      module.exports.unusedLate = 'unused-late'
      ```
      
      Previously, we'd treat all of these as exports. Even though some of them
      aren't, this PR cleans that inaccuracy up so that scope-hoisting can
      land without a bug.
      
      Now this does cause an odd case, consider:
      
      ```javascript
      // Discarded by the literal below, so not an export.
      exports.early = 'early-value'
      exports.unused = 'unused-value'
      
      module.exports = {
        used: 'used-value',
        unused: 'unused-value',
      }
      
      // Not exports: `exports` and top-level `this` hold the object the literal discarded.
      exports.deadExports = 'dead-exports'
      this.deadThis = 'dead-this'
      Object.defineProperty(exports, 'deadDefined', { value: 'dead-defined' })
      
      // Exports: `module.exports` is the live object.
      module.exports.usedLate = 'used-late'
      module.exports.unusedLate = 'unused-late'
      ```
      
      We would actually not drop:
      
      ```
      exports.unused = 'unused-value'
      ```
      
      Now. But I'm going to make a follow-up PR to drop these.
      1dd15c50
    • next-js-bot[bot]'s avatar
      v16.3.1-canary.0 · 5005bd08
      next-js-bot[bot] authored
      5005bd08
    • Andrew Clark's avatar
      Fix catch-all index page being served for every other slug (#96553) · 5f735c1a
      Andrew Clark authored
      Navigating between sibling pages of an optional catch-all could leave
      the URL updated but the content stuck on the route's index page, with no
      request made at all. On nextjs.org that is every /docs/* sidebar link,
      once /docs itself has been prefetched.
      
      The App Shell of a segment is the part that doesn't depend on params, so
      the cache keeps one copy and reuses it for every param value. The client
      decides it has that shell when a response arrives without a shell/full
      split.
      
      But a response arrives without a split whenever the render had no
      dynamic hole, and that is also what a page fully prerendered at concrete
      params looks like. The split alone can't tell the two apart, and the
      second is not param-independent at all — its content is the params. So
      the /docs page was stored as the shell for every slug. Because a payload
      that needs nothing further is also recorded complete, sibling slugs read
      it and stopped there: no prefetch, and no dynamic request during
      navigation to correct it.
      
      Treat a payload as param-independent only on evidence. The server
      already reports which params each segment depends on, so use that.
      Without it, assume every param varies, except for a shell variant, which
      reduces param-dependent content to param fallbacks and so is good for
      any value of them.
      
      The new e2e suite prefetches a fully static catch-all index, navigates
      there, then prefetches and navigates to a sibling slug. It fails on
      canary with a prefetch that never fires, and is verified with vary
      params both enabled and disabled.
      5f735c1a
    • next-js-bot[bot]'s avatar
      v16.3.0 · d73f5622
      next-js-bot[bot] authored
      d73f5622
    • Joseph's avatar
      Edits to turbopackFileSystemCache (#96531) · 2e0d4cbe
      Joseph authored
      - Rework the
      `/docs/app/api-reference/config/next-config-js/turbopackFileSystemCache`
      API reference.
      - Adjust the table notes in
      `/docs/app/api-reference/turbopack#configuration` — `[^1]` works well,
      but the table notes are auto-magically placed at the bottom of the page.
      Going with this hand rolled table notes for now.
      - Tidy the Build Caching section in
      `/docs/app/api-reference/turbopack#configuration`
      - Update the Upgrade to version 16 section on dev/build cache
      - Removed the `Build caching` from Webpack gaps
        - Added Filesystem caching to Performance and Fast Refresh
      2e0d4cbe
    • Joseph's avatar
      docs: cover direct visits and client navigations in the instant() e2e example (#95803) · 86df9c75
      Joseph authored
      Reworks the instant-navigation guide's e2e testing example to cover both
      ways a route is reached: a direct visit (SSR document load) and a client
      navigation.
      
      Each test wraps the navigation in `instant()` and asserts the shell
      renders while the streamed content is held back, then appears after.
      
      Also documents where the testing API is available: automatically under
      `next dev`, and in a production build via
      `experimental.exposeTestingApiInProductionBuild`.
      
      Closes:
      https://linear.app/vercel/issue/DOC-6477/instant-e2e-helper-for-ssr-and-soft-navs-snippets-show-difference
      
      ---------
      Co-authored-by: 's avatarAurora Scharff <aurora.sofie@gmail.com>
      Co-authored-by: 's avatarAurora Scharff <66901228+aurorascharff@users.noreply.github.com>
      86df9c75
    • Sam Poder's avatar
      [turbopack / next.js] Add an end-to-end test for new root detection (#96544) · 47a52c0d
      Sam Poder authored
      Follow-up PR to https://github.com/vercel/next.js/pull/96159, adding an
      end to end test that specifically tests the new stuff in that PR!
      47a52c0d
    • Andrew Clark's avatar
      Remove implicit Partial Prefetching opt-in from `instant` (#96539) · 8e878d48
      Andrew Clark authored
      Previously, adding a truthy `instant` config to a route segment (e.g.
      `export const instant = true`) did two things: it enabled instant
      navigation validation, and it implicitly opted the route into Partial
      Prefetching.
      
      Now those concerns are fully separate. `instant` only controls
      validation, so enabling it no longer silently changes how a route is
      prefetched. Partial Prefetching is enabled with the `prefetch` segment
      config (`'partial'` or `'unstable_eager'`), or globally with the
      `partialPrefetching` option in next.config.
      
      For routes whose only opt-in was a truthy `instant`, `<Link
      prefetch={true}>` goes back to performing a legacy full prefetch instead
      of being downgraded to a partial one. `instant = false` still opts a
      route out of the dev-time `prefetch={true}` warning.
      
      Adds a regression test asserting that a route that only exports `instant
      = true` keeps the full-prefetch behavior.
      8e878d48
    • Tim Neutkens's avatar
      Fix deploy test TypeScript exclusions (#96545) · e37ddd19
      Tim Neutkens authored
      ## Summary
      
      Set `NEXT_PRIVATE_LOCAL_DEV=1` for directory fixtures in deploy mode,
      matching the next-start setup. This keeps copied test runner files
      excluded from TypeScript checks when deployment tests use
      `tsconfig.test.json`.
      
      ## Verification
      
      - `pnpm exec tsc --project test/lib/tsconfig.json --noEmit`
      - Not run: deployment tests (requires Vercel deployment credentials)
      
      <!-- NEXT_JS_LLM -->
      e37ddd19
    • Aurora Scharff's avatar
      docs: clarify first-party Skills workflows (#96495) · 8a4920c1
      Aurora Scharff authored
      ## Summary
      
      - clarify how runtime foundations, interactive workflows, and unattended
      loops fit into the AI agents and Instant Navigation guides
      - harden the Cache Components and Partial Prefetching Skills around
      capability checks, trustworthy `instant()` tests, route scope, and
      real-app verification failures
      - add migration-guide comments to temporary Partial Prefetching route
      config and update `remove-partial-prefetch` to remove only generated
      comments while preserving runtime-prefetch TODOs and user comments
      
      This keeps the experimental Partial Prefetching optimizer in #96471
      separate.
      
      ## Testing
      
      - `pnpm --filter @next/codemod build`
      - `pnpm --filter @next/codemod test --
      transforms/__tests__/remove-partial-prefetch.test.js --runInBand`
      8a4920c1
    • Marcos Hernanz's avatar
      Flag newly disabled deploy tests (#96505) · 4344b83a
      Marcos Hernanz authored
      ## What changed
      
      Added scoped review guidance under `test/` so Vercel Agent flags changes
      that newly disable deploy-mode tests or assertions.
      
      ## Why
      
      Deploy coverage should only be disabled for assertions that are
      inherently self-hosted-specific. When deployed behavior differs, the
      test should prefer documenting those semantics instead of skipping
      deploy mode.
      
      ## Validation
      
      - `pnpm install --frozen-lockfile`
      - `pnpm build-all`
      - Hosted Vercel Agent E2E: an intentional `skipDeployment: true` probe
      was flagged inline, then removed
      - Hosted Vercel Agent Review passed on the final diff
      4344b83a
    • Joseph's avatar
      fix: double fragment on navigation (#93132) · 459617a1
      Joseph authored
      Fixes: https://github.com/vercel/next.js/issues/93126,
      https://github.com/vercel/next.js/issues/95551
      
      Repro:
      
      - from `/` navigate to `/abc#foo`
      - on `/abc#foo` - now click `/abc#bar`
      - the url is now at `/abc#foo#bar`
      
      Unlike, https://github.com/vercel/next.js/pull/93855, this PR fixes what
      gets stored in the segment cache navigation, rather than slicing away an
      existing hash. It is plausible that dropping the hash from the segment
      cache is not desired though.
      459617a1
    • Tim Neutkens's avatar
      Enable TypeScript CLI by default (#96497) · cbf0cef6
      Tim Neutkens authored
      ## Summary
      
      Enable the project-local TypeScript CLI checker by default during `next
      build`, while preserving `experimental.useTypeScriptCli: false` as an
      opt-out to the TypeScript compiler API. Update the TypeScript 7
      guidance, diagnostics, tests, and documentation to match the new
      default.
      
      ## Verification
      
      - `pnpm exec jest --runTestsByPath test/unit/isolated/config.test.ts`
      - Pre-commit lint-staged checks passed (Prettier and ESLint)
      - Not run: `pnpm test-start-turbo
      test/production/app-dir/typescript-cli/typescript-cli.test.ts` (isolated
      fixture dependency installation was blocked by unavailable npm registry
      access)
      - Not run: `pnpm --filter=next types` (repository has pre-existing
      unrelated TypeScript errors)
      
      <!-- NEXT_JS_LLM -->
      cbf0cef6
    • Zack Tanner's avatar
      test: skip hybrid not-found coverage for the legacy builder (#96534) · dcdacfd0
      Zack Tanner authored
      ## Summary
      
      The `pages-router-app-not-found` test verifies behavior implemented by
      the Next.js adapter. The legacy `@vercel/next` builder has a
      pre-existing behavior where it prefers the Pages Router error page for
      this hybrid routing case.
      
      Skip this test when deployment tests run without the adapter. It will
      continue running in development, `next start`, and adapter deployment
      tests.
      
      ## Verification
      
      - `NEXT_TEST_MODE=deploy NEXT_ENABLE_ADAPTER=0 pnpm testheadless
      test/e2e/app-dir/pages-router-app-not-found/pages-router-app-not-found.test.ts`
      - `pnpm testheadless
      test/e2e/app-dir/pages-router-app-not-found/pages-router-app-not-found.test.ts`
      dcdacfd0
    • Joseph's avatar
      docs: ISR with Cache Components and Partial Prefetching (#96526) · 2aef3b81
      Joseph authored
      App Shell upgrade for prerendered fallbacks, are now gated behind
      `partialPrefetching`.
      2aef3b81
    • David Alexandru Ilie's avatar
      Fix App Router scroll padding visibility (#96308) · da907823
      David Alexandru Ilie authored
      ## Summary
      
      - Treat the root `scroll-padding-top` as the lower boundary of the
      usable viewport during App Router navigations, so content obscured by a
      sticky header is not incorrectly considered visible.
      - Preserve the merged Fragment scroll-ownership state machine: empty
      Fragments remain unavailable targets, while real targets are classified
      against the padding-aware viewport.
      - Resolve pixel and percentage values and use the same visibility rule
      in both the legacy element handler and the Fragment-ref handler.
      - Add regression coverage showing that Next scrolls when the destination
      is hidden inside the padding boundary, while preserving the current
      scroll position when the destination is genuinely visible below it.
      
      ## Performance
      
      The root computed style is resolved lazily, only after the candidate
      produces client rects. Empty Fragments and hash navigations do not
      perform this lookup. For a real route-scroll target, the resolved value
      is cached locally and reused by the second geometry check after
      `scrollTop = 0`.
      
      This does not add work to scroll events or every render, and keeping the
      value local allows responsive CSS, root classes, and custom properties
      to change between navigations. In a 50-iteration dirty-style Chromium
      probe, both the existing and updated paths reported 50 style
      recalculations and 50 layouts, indicating that the lookup reused the
      style/layout update already required by the handler in that test.
      
      ## Related work
      
      #96342 is now merged into `canary` and handles empty Fragment scroll
      ownership. This PR composes with its `NoClientRects` / `InViewport` /
      `OutOfViewport` state machine by changing only the visible-region
      boundary for real targets.
      
      ## Verification
      
      - `HEADLESS=true pnpm test-dev-turbo
      test/e2e/app-dir/router-autoscroll/router-autoscroll.test.ts -t "scroll
      padding"` (3/3)
      - `HEADLESS=true __NEXT_EXPERIMENTAL_APP_NEW_SCROLL_HANDLER=false pnpm
      test-dev-turbo
      test/e2e/app-dir/router-autoscroll/router-autoscroll.test.ts -t "scroll
      padding"` (3/3)
      - `HEADLESS=true pnpm test-dev-turbo
      test/e2e/app-dir/parallel-routes-scroll-owner/parallel-routes-scroll-owner.test.ts`
      (8/8)
      - `HEADLESS=true pnpm test-dev-webpack
      test/e2e/app-dir/parallel-routes-scroll-owner/parallel-routes-scroll-owner.test.ts`
      (8/8)
      - `HEADLESS=true pnpm test-dev-turbo
      test/e2e/app-dir/navigation-focus/navigation-focus.test.ts` (5/5)
      - Manually compared the same sticky-header reproduction before and after
      the change.
      
      <!-- NEXT_JS_LLM -->
      da907823
    • Hendrik Liebau's avatar
      [ci] Wait for the preview tarballs before running the deploy tests (#96527) · c00449d5
      Hendrik Liebau authored
      The "Test new and changed tests when deployed" jobs install Next.js from
      the preview tarballs built for the commit under test, but nothing made
      them wait for those tarballs to exist. Until #96438 the job was ordered
      behind `test-prod` and the other new-test jobs, which delayed it long
      enough that the tarballs had usually landed by the time it looked for
      them. Now that it starts immediately it frequently fails with "Artifacts
      not found for commit ...".
      
      The ordering cannot be expressed as a `needs:` entry, because the
      tarballs are published by a different workflow and, for pull requests
      from branches in this repository, a different event than the
      `build-and-test` run that consumes them. We therefore add a
      `wait-for-preview-tarball` job that polls for the tarball instead, and
      make both deploy test jobs depend on it. Doing the waiting in one cheap
      job keeps the deploy test matrices off their 16-core runners until there
      is something for them to install.
      
      The new job is also listed in `tests-pass`. A dependency failure skips
      the jobs that need it, and a skipped job does not count as a failure, so
      without that entry a tarball that never arrives would have let the
      required check pass with the deploy tests never having run.
      
      `test-new-tests-deploy-cache-components` gets the same treatment,
      dropping the incidental ordering it still inherited from
      `test-cache-components-prod` and picking up the docs-only guard that
      `test-new-tests-deploy` already had.
      c00449d5
    • Steven's avatar
      [turbotrace] bump test version of sharp (#96386) · 767e0e98
      Steven authored
      Regenerate the lockfile to test if the previous PR still works with the
      latest sharp
      
      - https://github.com/vercel/next.js/pull/94845
      767e0e98
    • Janka Uryga's avatar
      [Cache] Make caches error if called after prerender aborts (#96426) · 33173924
      Janka Uryga authored
      Closes #96339
      
      Caches that started filling after a prerender was aborted would produce
      an empty stream, because an aborted `renderSignal` made [the signal we
      pass to `prerender()` inside `use-cache-wrapper`] be aborted
      immediately. So we produced an empty entry and saved it, essentially
      poisoning the cache.
      
      Fixed by removing `renderSignal` from the `AbortSignal.any(...)` we pass
      in and returning a rejected promise before we get to the cache filling
      codepath. This should not be observable to userspace because the
      prerender is already aborted.
      33173924