1. 23 Sep, 2026 29 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.40 · c9b90452
      next-js-bot[bot] authored
      c9b90452
    • Josh Story's avatar
      Keep cached root parameters out of generic fallback shells (#98950) · 2d895935
      Josh Story authored
      ## Summary
      
      Replace #98892 with a fix for both ways root-dependent content can enter
      a generic fallback shell: reusing an existing Resume Data Cache entry
      and executing a fresh cache fill.
      
      For example, cached English content produced for `/en/items/one` remains
      reusable in `/en/items/[slug]`, but must be absent from
      `/[lang]/items/[slug]`. When reusing that concrete prerender as a seed,
      clone its cache map and replace entries whose recorded
      `readRootParamNames` intersect the unknown roots with omission markers.
      The original seed is unchanged.
      
      Keep those markers in the cache map itself, not a separate collection
      that must stay synchronized. They carry the reason for a hole between
      prerender passes and are never serialized into the persisted RDC.
      Preserve canary's distinction between URL data and session data when
      computing shell and prefetch hints.
      
      For fresh fills, an unknown root read suspends the entire cache
      invocation, including cached components with an internal Suspense
      boundary. Affected nested caches use independently cancellable
      prerenders. Dependencies propagate through consumers without cancelling
      independent sibling fills or saving aborted partial results.
      
      A top-level caller joining a nested cache fill must also record the
      omission marker: the nested leader has no RDC of its own. Otherwise the
      final prerender sees an unexplained miss and loses the fallback's
      prefetch hint. This applies to intra-request joins as well as
      cross-request joins.
      
      This is prerequisite work for configurable root fallbacks in #97393.
      Without the new API, ordinary misses for root parameters still block.
      The prerequisite fixture inspects ordinary build artifacts and document
      requests; the API fixtures exercise fresh fills through real fallback
      requests and tag invalidation. Neither uses forced rendering or
      shell-debugging hooks.
      
      ## Verification
      
      - Prerequisite root-cache fixture: five production tests pass with both
      Webpack and freshly built Turbopack.
      - API root-cache isolation and root-parameter fixtures: eleven
      production tests pass with each bundler. Fourteen closed-route
      revalidation tests also pass with Webpack after restacking.
      - The new nested-leader/top-level-join regression fails without the
      marker write with the reported unexpected-cache-miss warning, and passes
      with the write. Data-service barriers determine the ordering; no timing
      sleeps or framework test hooks are used.
      - Existing runtime prerender cache-warming coverage: eight Webpack tests
      pass, including cached pages that await params/searchParams.
      - The three focused unit suites pass together: 114 tests on this
      prerequisite and 128 on the API layer, with four snapshots each. The
      postponed-state assertion no longer snapshots Node's incidental
      async-hooks fields on promises.
      - Full workspace/native builds and package/repository type checks pass.
      - Deployment tests were not run locally for this update.
      
      <!-- NEXT_JS_LLM -->
      2d895935
    • Hendrik Liebau's avatar
      Fix missing content in Cached Navigations (#98767) · ec0abf41
      Hendrik Liebau authored
      React can render outlined elements in later `setImmediate` callbacks
      after an asynchronous cache read resolves. `cacheReady()` can resolve
      before those elements start their cached reads. The embedded prerender
      for Cached Navigations then reports unexpected cache misses and omits
      cacheable content.
      
      This change tracks pending native immediates in an `AsyncLocalStorage`
      scope around each Cache Components render. `CacheSignal` waits for that
      work before accepting a zero read count. If more native immediates
      appear before the readiness timer runs, it waits and checks again.
      Tracking does not make native immediates fast or change the existing
      explicit, task-local fast-immediate behavior.
      
      The e2e regression uses a delayed cache handler and a large outlined
      tree. It verifies that Cached Navigations reuse outlined content while
      content behind dynamic I/O remains uncached. Each test invocation uses a
      fresh cache key through `searchParams`, so cases and retries cannot
      reuse previously warmed entries.
      
      Unit tests in the existing immediates suite cover scope isolation,
      nested scheduling, cancellation, native scheduling semantics, and error
      recovery.
      
      Fixes #98543
      ec0abf41
    • Sam Poder's avatar
      [turbopack] Track members across namespace re-exports (#96396) · b1c15da6
      Sam Poder authored
      ## What?
      
      This PR closes a missed tree-shaking opportunity for libraries that
      expose a module namespace as a named export. One real-world example is
      Zod, whose public API has a structure similar to the following (and this
      pattern also appears in v0's codebase):
      
      ```js
      // user.js
      import { z } from './lib.js'
      
      console.log(z.object(), z.string(), z.defaultLocale)
      ```
      
      ```js
      // lib.js — mirrors zod/index.js
      import * as z from './external.js'
      
      export * from './external.js'
      export { z }
      export default z
      
      // external.js — mirrors zod/v4/classic/external.js
      import en from './locales/en.js'
      
      export * as locales from './locales/index.js'
      
      export const object = () => 'object'
      export const string = () => 'string'
      export const defaultLocale = en
      ```
      
      The analyzer can now preserve the information that only `object`,
      `string`, and `defaultLocale` are read from `z`, and use it after
      resolving that named export to the namespace of `external.js`.
      
      This PR is now standalone on `canary`. Its two former prerequisites have
      landed: #98680 introduced the independently reviewed
      `EsmAssetReferenceOptions` constructor refactor, and #96282 integrated
      CommonJS and ESM whole-namespace forwarding with canary's generic
      `ExportUsage::Passthrough` fixed point.
      
      ## Why?
      
      Previously, Turbopack knew that the named export `z` was used, but lost
      the static member information from expressions such as `z.object()`.
      Once `z` resolved to a namespace object, the optimizer therefore kept
      every export of `external.js` — including `locales` and all of
      `./locales/index.js` in this example.
      
      The optimization must remain conservative in several cases:
      
      - a computed property whose name cannot be determined statically, such
      as `z[key]`;
      - a namespace binding that escapes to unknown code, such as passing `z`
      to another function;
      - static and opaque uses of the same binding, where the opaque use must
      dominate narrowing;
      - live exports and method calls, whose binding and receiver semantics
      must not change.
      
      It must also avoid changing ordinary named-import behavior. A property
      read on an imported value is not proof that the value is a module
      namespace; narrowing and namespace provenance are valid only after
      re-export resolution proves that fact.
      
      ## How?
      
      ### Represent namespace-member requests explicitly
      
      The module-part model now has explicit states for this operation:
      
      - `ExportedNamespaceMember { export, member }` represents a static
      member read on a named export before re-export resolution;
      - `RenamedNamespaceMember { export, member }` represents the case after
      that export resolves to a module namespace.
      
      This avoids overloading an ordinary `Export` or an optional `member`
      field with two meanings. It also keeps existing `Export` and
      `RenamedNamespace` identities unchanged; the new variants have distinct
      hashes only for the new states.
      
      Multiple static reads and multiple aliases are tracked as independently
      keyed references, so `z.object`, `z.string`, and `z.defaultLocale` all
      survive rather than overwriting one another.
      
      ### Narrow only after proving the export is a namespace
      
      The analyzer records a statically known member on an imported binding
      while leaving the emitted member expression intact. Re-export following
      first resolves the outer named export:
      
      1. If it resolves to a namespace object, Turbopack synthesizes a
      namespace-member reference to the resolved module and contributes
      `PartialNamespaceObject({ member })` there.
      2. If it resolves to an ordinary named export, it continues to behave
      like a normal named read of the outer module. It does not mark the
      module as namespace-observable or unnecessarily disable export-name
      mangling.
      
      Dynamic property access and escaping bindings do not produce a narrowed
      member part, so they continue to retain the full namespace. When static
      and opaque uses are joined, the full-namespace use wins.
      
      The explicit module-part variants are threaded through both fragment and
      non-fragment infrastructure so they remain valid graph identities. The
      new `ExportedNamespaceMember` rewrite itself currently runs only when
      module fragments are disabled. A dedicated `moduleFragmentsEnabled:
      true` fixture verifies the supported existing split behavior without
      claiming that this new rewrite is active there.
      
      While rebasing, canary moved follow-reexport canonicalization into
      `turbopack-ecmascript` so lazy dynamic imports can carry the same
      canonicalization policy. Namespace-member handling now lives in that
      canonicalization helper as well, preserving both the new
      lazy-compilation path and this PR's namespace rewrite.
      
      ## Testing
      
      Enabled coverage includes:
      
      - the Zod-shaped snapshot showing only `object`, `string`, and
      `defaultLocale` retained while the unused locale namespace is removed;
      - multiple static members on one namespace-valued export;
      - dynamic access, escaping use, and mixed static/opaque use retaining
      the full namespace;
      - direct `export * as`, including an enabled used/unused precision
      assertion;
      - computed-string, parenthesized, optional, and missing-property reads;
      - `this`-sensitive method calls;
      - default-exported and renamed namespace values;
      - live bindings read and mutated through multiple aliases, with single
      evaluation;
      - nested namespace runtime behavior and top-level-await targets;
      - scope-hoisted, non-scope-hoisted, and module-fragment configurations;
      - export-name mangling safety and non-pessimization across #96282's
      forwarding edges.
      
      Development coverage updates both a value behind the CommonJS forwarding
      edge and a statically read namespace member, verifying HMR observes each
      new value without stale exports or runtime errors.
      
      One optimization-only limitation is documented under
      `__skipped__/namespace-value-reexport-nested`: member narrowing
      currently stops after the first namespace level for a read such as
      `z.locales.en`. The full nested runtime behavior is covered by the
      enabled `namespace-value-reexport` fixture.
      
      Local verification on the standalone canary rebase passes affected-crate
      and `next-core` checks, 14 focused execution/snapshot tests, the merged
      passthrough/annotation unit tests, 60 analyzer graph tests, `build-all`,
      and the development/HMR test. A throwaway ordinary object-valued
      named-import fixture also verified that the pre-resolution path
      preserves property values and `this` for getters and methods; it was
      removed after review.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 993ef5d6-cc80-4082-8e14-ff9ac871ce33 -->
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
      Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
      b1c15da6
    • Janka Uryga's avatar
      [PPF] Implement `unstable_ensureStatic = "shell" | "prefetch"` (#98191) · 1edced6f
      Janka Uryga authored
      Builds on #98129, where we made it possible for shells to be static
      while the prefetches depending on where runtime data is accessed:
      - `ensureStatic = "shell"` simply defers all runtime tracking until the
      prefetch (semantically, it's as if it was gated by `await prefetch()`).
      this means that the shell will always be considered static (although the
      prefetch can still be runtime)
      - `ensureStatic = "prefetch"` is analogous, but means that the prefetch
      should be static (semantically, it's as if it was gated by `await
      navigation()`). this effectively skips the tracking altogether, and
      *both* the shell and the prefetch will be static.
      - notably, in this mode, accessing fallback params in an ISR fallback no
      longer sets `needsRuntimeRequest` either, because the config disallows
      runtime prefetches, even if it'd let us skip waiting for the ISR
      prerender to finish.
      
      note that "static" here means "statically prerendered", as opposed to
      "rendered on demand via runtime prerender". both options still allow the
      prerender to have dynamic holes. disallowing dynamic holes altogether
      will be handled by `ensureStatic = "navigation"` in a follow up.
      
      ### Implementation notes
      
      i've also renamed `walkNeedsRuntimeCompleteness` to
      `walkCanUseRuntimeRequests` -- in practice, the function checks "is this
      a PPF route", but being PPF no longer means that runtime completeness is
      required, because `ensureStatic` deliberately gets rid of it.
      `walkCanUseRuntimeRequests` is a bit more accurate, because it tells us
      whether runtime requests are possible at all. This change (and the
      associated changes in comments) are in a separate commit for ease of
      review.
      1edced6f
    • Janka Uryga's avatar
      [PPF] Validate `unstable_ensureStatic` nesting (#98357) · 690f1ad8
      Janka Uryga authored
      `ensureStatic` forms a hierarchy: `"auto" < "shell" < "prefetch" <
      "navigation"`, with each value being more contrained than its
      predecessor.
      
      1. A child segment cannot relax constraints set by a parent segment, it
      can only tighten them
      - so `shell` in a layout and `prefetch` in a page is fine, but the
      opposite is not
      - note that setting `"auto"` in the child *is* allowed, because it means
      "unconstrained" and is compatible with all the other configs
      2. We can't have two conflicting levels set by two parallel slots (but
      `auto` is compatible with any other constraint, so it's allowed, same as
      above)
      3. If a segment sets `ensureStatic = false`, then no other segments on
      that route are allowed to constrain the route by setting anything higher
      than `auto` (this is meant as a signal for e.g. "this segment
      DELIBERATELY uses a runtime shell and should not be overridden to be
      static")
      
      Also adds exhaustive tests for all of these scenarios.
      690f1ad8
    • Sebastian "Sebbie" Silbermann's avatar
      Replace lerna task-runner usage with pnpm (#99040) · e09ac7d2
      Sebastian "Sebbie" Silbermann authored
      pnpm solves all the remaining usages of Lerna so we're switching to pnpm
      instead. The goal is to get rid of Lerna.
      e09ac7d2
    • Sebastian "Sebbie" Silbermann's avatar
      [cd] Fix release branch gate and drop dead lerna publish config (#99039) · 2884eb21
      Sebastian "Sebbie" Silbermann authored
      Mostly just updating obsolete/stale information.
      2884eb21
    • Niklas Mischkulnig's avatar
      Turbopack: fix "ModuleId not found for ident" regression (#99090) · 593cec11
      Niklas Mischkulnig authored
      Regression from #98617
      
      Closes #99082
      593cec11
    • Hendrik Liebau's avatar
      Fix private-cache segment reuse across root params (#98810) · 9806642f
      Hendrik Liebau authored
      Private caches only tracked root-param reads in development. Production
      runtime prefetches omitted these dependencies from their vary params
      metadata, allowing the client to reuse content across different
      root-param values.
      
      This extends #98674 to `"use cache: private"`. Private caches now
      collect root-param reads in production and inherit dependencies from
      nested public and private caches. The existing response-level
      propagation can then record those dependencies when it consumes the
      cache entry.
      
      Regression tests cover direct reads, public caches inside private
      caches, and private caches inside private caches. Each case prefetches
      English and German content, then verifies that navigation uses the
      German result without another request.
      9806642f
    • Niklas Mischkulnig's avatar
      Turbopack: fix `Unknown module type` error for imports in webpack loaders (#99088) · 3e4af55d
      Niklas Mischkulnig authored
      Fixes an error like
      ```
      ./node_modules/.pnpm/@esbuild+linux-x64@0.28.1/node_modules/@esbuild/linux-x64/README.md
      Error: Unknown module type
      This module doesn't have an associated type. Use a known file extension, or register a loader for it.
      ```
      
      Regression from https://github.com/vercel/next.js/pull/95732
      3e4af55d
    • Jiwon Choi's avatar
      Nudge humans to adopt Future Defaults (#98874) · 7f79552e
      Jiwon Choi authored
      Stacked on #98873.
      
      Counter part of agent nudge for auto upgrade. Prompt user when runs
      `next dev` or `next build` based on `experimental.agenticAutoUpgrade`
      value. This PR covers `future`.
      7f79552e
    • Jiwon Choi's avatar
      Nudge latest version upgrades for manual `next dev|build` (#98873) · 59a5fae3
      Jiwon Choi authored
      Stacked on #98872.
      
      Counter part of agent nudge for auto upgrade. Prompt user when runs
      `next dev` or `next build` based on `experimental.agenticAutoUpgrade`
      value. This PR covers `latest`.
      59a5fae3
    • Jiwon Choi's avatar
      Nudge security upgrades for manual `next dev|build` (#98872) · 447e018f
      Jiwon Choi authored
      Counter part of agent nudge. Prompt user when runs `next dev` or `next
      build` based on `experimental.agenticAutoUpgrade` value. This PR covers
      `security`.
      447e018f
    • next-js-bot[bot]'s avatar
    • Tobias Koppers's avatar
      refactor(turbo-rcstr): drop unsupported 16-byte pointer width (#98355) · cde6fad2
      Tobias Koppers authored
      ## What?
      
      Removes turbo-rcstr's 16-byte/128-bit pointer representation and the
      unused `atom_size_64` feature plumbing. Unsupported pointer widths now
      fail with an error that names the supported 32-bit and 64-bit widths.
      
      ## Why?
      
      This follows up on review feedback from #97577. The previous negative
      cfg made unknown pointer widths fall through to the 64-bit
      representation, while the 16-bit implementation and `atom_size_64`
      features had no users. Making both supported widths explicit keeps
      representation assumptions visible and produces a useful failure for
      unsupported targets.
      
      ## How?
      
      The narrow tagged-value layout is now specific to 32-bit targets, and
      the pointer-sized layout is specific to 64-bit targets. `atom_size_128`
      remains unchanged. The dead feature declarations are removed from
      turbo-rcstr and its proc-macro crate.
      
      ## Verification
      
      - `cargo test -p turbo-rcstr --lib`
      - `cargo test -p turbo-rcstr --lib --target wasm32-wasip1-threads`
      - `cargo check -p next-napi-bindings`
      - `cargo check -p next-napi-bindings --target wasm32-wasip1-threads`
      - `cargo clippy -p turbo-rcstr -p turbo-rcstr-macros -- -D warnings`
      - `cargo clippy -p turbo-rcstr -p turbo-rcstr-macros --target
      wasm32-wasip1-threads -- -D warnings`
      - `cargo fmt --all -- --check`
      
      <!-- NEXT_JS_LLM -->
      
      <!-- fleet 7cfc7d6e-efc8-4ef3-b81c-b90f71291bb0 -->
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
      cde6fad2
    • Tobias Koppers's avatar
      test(turbo-tasks-backend): run the db_versioning tests on wasm (#97901) · d940cd30
      Tobias Koppers authored
      ### What?
      
      Makes `turbo-tasks-backend`'s `db_versioning` tests run on
      `wasm32-wasip1-threads` instead of being
      skipped, by routing temporary-directory creation in tests through a
      small helper that does not depend
      on `std::env::temp_dir()`.
      
      Twelve test instances that were previously skipped now execute on wasm.
      Three related
      `kv_backing_storage` instances remain skipped, but for a different — and
      verified — reason (see below).
      Native behaviour is unchanged: the same tests run exactly as before, and
      nothing is newly skipped there.
      
      The wider WASI suite also exposed an unrelated intermittent stall in
      `test_unbounded_busy_queue_does_not_churn_workers`: passing isolated
      runs finish in about 0.25 seconds,
      while repeated runs can stop making progress indefinitely. That stress
      test is now ignored only on
      WASI, with the observed reason recorded; native coverage remains enabled
      while the underlying
      multi-threaded runtime stall is investigated separately.
      
      ### Why?
      
      These tests were skipped with the reason `no temp directory on WASI`,
      which turned out to be only half
      true. WASI genuinely has no notion of a system temp directory —
      `std::env::temp_dir()` is hard-coded to
      `unsupported()` in `std/sys/paths/wasi.rs`, so it panics regardless of
      `TMPDIR` — but the *filesystem
      itself works fine*. A WASI guest can use any directory the host preopens
      for it.
      
      So the blocker was in how the tests asked for a directory, not in the
      platform. Asking WASI where "temp"
      is fails; creating a directory inside a path the host already granted
      succeeds.
      
      This matters beyond tidiness: skip reasons are the primary record of
      what does and does not work on
      wasm, and an inaccurate one is worse than no reason at all, because it
      makes a fixable problem look like
      a platform limit and quietly discourages anyone from trying.
      
      Fixing it also uncovered the *real* limitation underneath. With temp
      directories working, the three
      `kv_backing_storage` tests get further and hit a genuine platform gap:
      `memmap2` ships `unix.rs`,
      `windows.rs` and a stub for every other target, so `turbo-persistence`
      cannot open a database on WASI
      at all (`Failed to mmap: platform not supported`). Those three are still
      skipped, now with that cause
      recorded instead of the temp-directory one. That is a real, separate
      piece of work — persistent caching
      cannot function on wasm until `turbo-persistence` grows a non-mmap read
      path — and it is now visible
      rather than hidden behind a misleading reason.
      
      ### How?
      
      A single test-only helper owns the platform difference, so the ~11 call
      sites stay identical in shape
      and no test carries its own `cfg`. On native it delegates to
      `tempfile::tempdir()`, preserving today's
      behaviour byte for byte, including having `TempDir` own cleanup. On wasm
      it creates the directory inside
      a preopened path instead of consulting the environment. The helper is
      crate-private and compiled only
      for tests, so it adds nothing to the shipped crate, and it returns
      `tempfile`'s own error type rather
      than erasing it.
      
      Two deliberate choices are worth calling out for review:
      
      - **Every remaining skip is justified by an observed failure**, not by
      inference. Each of the three
      `kv_backing_storage` tests was run individually and traced to
      `memmap2`'s stub before being skipped
      again; the twelve `db_versioning` ones were confirmed to pass. Nothing
      is skipped speculatively.
      - **Skips use `ignore` with a reason rather than `cfg`**, so they appear
      in test output as
      `ignored, <reason>` instead of silently vanishing from the run. That is
      what keeps the count of
      what-doesn't-work-on-wasm honest and reviewable, and it is asserted that
      the native run still has
        zero ignored tests.
      
      The wasm coupling is documented at the helper: it relies on the host
      preopening a directory, which the
      repository's Node wasi test host does. A different runner must provide
      the same, or update the helper.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet b6d0486f-97c7-42a7-bdaf-3490774cdec3 -->
      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>
      d940cd30
    • Tobias Koppers's avatar
      fix(turbo-tasks): let parking_lot block on wasm instead of panicking (#97860) · a70cf087
      Tobias Koppers authored
      ### What?
      
      Makes `parking_lot` locks actually block on wasm instead of panicking,
      and removes 33 of the 35
      `ignore`s that panic had forced onto the wasm test suites.
      
      ### Why?
      
      `parking_lot_core` picks its thread parker in `thread_parker/mod.rs`.
      The working wasm parker
      (`wasm_atomic.rs`, built on `memory_atomic_wait32` /
      `memory_atomic_notify`) is selected only under
      
      ```
      all(feature = "nightly", target_family = "wasm", target_feature = "atomics")
      ```
      
      Otherwise it falls back to `wasm.rs`, whose `park()` is
      `panic!("Parking not supported on this platform")`.
      `wasm32-wasip1-threads` **does** report
      `target_feature = "atomics"`, so the only missing piece was the feature
      — every contended lock
      panicked, which is why so many tests were ignored on wasm.
      
      ### How?
      
      Two changes, and **neither alone is sufficient**:
      
      - bump `parking_lot_core` 0.9.8 → 0.9.12, because 0.9.8's atomic parker
      needs `feature(stdsimd)`,
        removed from Rust long ago;
      - enable `parking_lot`'s `nightly` feature **for wasm targets only** (it
      forwards to
      `parking_lot_core/nightly`). 0.9.12 *still* gates the atomic parker
      behind it, so a bump on its own
        keeps selecting the panicking stub silently.
      
      Verified on the resolved feature graph rather than the manifest —
      `nightly` is present for
      `wasm32-wasip1-threads` and absent for the host.
      
      ### Testing
      
      `contended_mutex_blocks_and_hands_over` is built so it cannot pass
      vacuously: a barrier guarantees the
      waiter actually contends, the waiter must block for a measurable
      interval, and it must observe the
      holder's write. **Negative control**: with the feature removed it fails
      at
      `parking_lot_core-0.9.12/src/thread_parker/wasm.rs:26` with *"Parking
      not supported on this platform"*.
      
      ```
      turbo-tasks          54 pass / 28 ignored  ->  72 pass / 11 ignored
      turbo-tasks-backend  66 pass / 32 ignored  ->  82 pass / 15 ignored
      native                     0 ignored, unchanged
      ```
      
      Two of the old ignores remain, under a different and verified cause:
      their work completes in ~500 ms
      of an 800 ms serial sum, so the parallelism is real, but dropping a
      multi-thread tokio runtime while
      their blocking helpers are still alive deadlocks on wasm. That was
      previously hidden because
      `panic = abort` killed the process at the failing assertion before
      teardown ran. It is fixed in the
      follow-up runtime layer.
      
      Also fixes a latent bug unrelated to wasm:
      `test_parallel_try_for_each_mut` asserted every element was
      incremented, which only holds when the chunk size is 1. Chunking comes
      from
      `available_parallelism() * 4` and each chunk stops at its first error,
      so with parallelism 1 the chunk
      size is 2 and every second item is skipped — it would fail on any
      single-core machine. It now asserts
      the parallelism-independent contract.
      
      
      <!-- fleet b6d0486f-97c7-42a7-bdaf-3490774cdec3 -->
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      a70cf087
    • Tobias Koppers's avatar
      test(turbo-tasks): run the wasm tests with a Node wasi host (#97789) · 4811e49e
      Tobias Koppers authored
      ### What?
      
      Adds a Node host so `wasm32-wasip1-threads` test binaries can run, and
      wires the `turbo-rcstr`, `turbo-tasks`, and `turbo-tasks-backend`
      library tests into the WASI CI job.
      
      It also provides the WASI allocation symbols expected by the `lz4-sys`
      dependency introduced by the base PR, allowing those test binaries to
      link.
      
      ### Why?
      
      The Rust test binaries require host functionality that stock WASI
      runners do not provide. Turbopack stores its link-time task registries
      in WebAssembly custom sections and imports a host callback to read them.
      Its multithreaded runtime also requires shared memory and thread
      spawning through Node Workers.
      
      The base PR replaces `lzzzz` with `lz4`. `lz4-sys 1.11.1` compiles its C
      sources against custom allocation shims on `wasm32-wasi*`, but excludes
      the Rust implementations when the target OS is WASI. Without equivalent
      symbols supplied by the consuming crate, test links fail on unresolved
      malloc, calloc, and free shims.
      
      Running these suites in CI gives the remaining WASI layers direct
      regression coverage instead of relying on native-only tests.
      
      ### How?
      
      The Node cargo target runner provides WASI preview1, imported shared
      memory, and the complete two-phase [`link-section` custom-section
      protocol](https://github.com/mmastrac/linktime/blob/ae29e51d94a955df2442ed6418b8a712c1f2bfb3/link-section/docs/PREAMBLE.md#wasm).
      
      
      [`@emnapi/wasi-threads`](https://github.com/toyobayashi/emnapi/tree/main/packages/wasi-threads)
      supplies Worker lifecycle, compiled-module transfer, load/start
      ordering, and cleanup for the
      [`wasi.thread-spawn`](https://github.com/WebAssembly/wasi-threads)
      import that Node's WASI runtime does not provide. The module is compiled
      once, then the structured-cloneable `WebAssembly.Module` and shared
      memory are sent to Workers. A small adapter around the package's
      lower-level `ThreadManager` and `ThreadMessageHandler` APIs preserves
      Rust's original one-argument ABI: the high-level `WASIThreads` wrapper
      requires guest `malloc`/`free` exports for that ABI, and Rust test
      binaries do not export them. Worker identifiers come from a shared
      atomic counter because Tokio Workers can spawn additional Workers while
      the main WebAssembly thread is parked.
      
      On WASI, `turbo-persistence` supplies the three allocation symbols
      required by liblz4 and forwards them to WASI libc, keeping allocation
      and deallocation within the same allocator. Native builds do not compile
      these wrappers.
      
      Tests that depend on unavailable platform behavior remain visible as
      WASI-only ignored tests with explicit reasons. Native runs keep the full
      test set enabled. A following stacked PR replaces the unsupported
      `parking_lot` parker and re-enables the corresponding contention tests.
      
      The workflow installs and builds the workspace before running the host
      because both the package dependency and compiled production support used
      by a later stack layer must be available.
      
      ### Verification
      
      - Node 20 host unit tests: 9/9
      - Exact combined WASI CI command: `turbo-rcstr` 12 passed / 1 ignored;
      `turbo-tasks` 68 / 44; `turbo-tasks-backend` 65 / 35
      - Full 111-test `turbo-tasks` binary through the package-managed host:
      95 passed / 16 ignored
      - No Worker-side `WebAssembly.compile`; the compiled module is
      transferred by `ThreadManager`
      - `pnpm install --lockfile-only --offline` with a frozen lockfile
      
      <!-- NEXT_JS_LLM -->
      
      <!-- fleet b6d0486f-97c7-42a7-bdaf-3490774cdec3 -->
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
      Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
      4811e49e
    • Sebastian "Sebbie" Silbermann's avatar
    • Hendrik Liebau's avatar
      [test] Add fallback param deployment regression coverage (#98883) · 3874b55d
      Hendrik Liebau authored
      Add permanent end-to-end regression coverage for omitted optional
      catch-all route parameters with the Vercel adapter. The fix in
      nextjs/adapter-vercel#126 is now released in the Vercel CLI; these tests
      keep the behavior covered in Next.js.
      
      The fixtures exercise `/[locale]/[[...filterSlugs]]` at `/en` during bot
      and draft-mode prerender bypasses and a fetch action. They also check
      optional route parameters alongside query parameters, draft-mode Cached
      Navigations, and locale data requests. This PR adds tests and fixtures
      without changing Next.js runtime behavior.
      3874b55d
    • Tobias Koppers's avatar
      Turbopack: mangle exports behind an escaping namespace via the facade (#97770) · 8b067039
      Tobias Koppers authored
      ### What?
      
      Allows Turbopack to keep mangling a module's internal export keys when
      its namespace object escapes. A facade preserves the original public
      names while forwarding each one to the mangled key in the locals module,
      matching webpack's materialized-namespace behavior.
      
      This PR is stacked on #98617. That lower PR now owns the generic
      synthetic-facade compact registration, including empty evaluation
      groups, descriptor reuse, scope-hoisted factories, pruned references,
      and cycle/async fallbacks. This PR creates those facades for escaping
      namespaces, so the generic path is exercised at scale here.
      
      ### Why?
      
      A namespace import or dynamic import whose reads cannot be enumerated
      currently disables mangling for the entire target module. That makes one
      broad consumer lose the size benefit for every otherwise-static consumer
      of the module.
      
      Materializing the original namespace surface keeps ESM semantics intact
      — including live values and `Object.keys()` — while allowing internal
      consumers to use shorter names.
      
      ### How?
      
      The facade's synthesized per-export references participate in the module
      graph, so named usage propagates to the locals module. Its structural
      locals edge carries evaluation usage only, while each forwarded name
      carries its own export usage. Part-reference code generation also honors
      references pruned by the graph, matching ordinary ESM references.
      
      Modules with no exports are not split, async modules retain the existing
      path, and real export-cycle circuit breakers avoid compact registration
      because they require their getters to be visible before imports run.
      Namespace grouping includes the SWC syntax context so scope-hoisted
      modules cannot accidentally share the wrong generated binding.
      
      ### Testing
      
      - `cargo test -p turbopack-ecmascript -p turbopack-tests` — **590 unit,
      303 execution, 3 auxiliary, and 131 snapshot tests passed** on the
      current stack
      - `cargo clippy -p turbopack-ecmascript -p turbopack-core -- -D
      warnings`
      - `cargo fmt --all -- --check`
      - `pnpm test-dev-experimental-turbo
      test/development/app-dir/lazy-dynamic-imports/lazy-dynamic-imports.test.ts`
      — 9/9 passed
      - `pnpm test-dev
      test/e2e/app-dir/instant-validation/suspense-boundaries.test.ts` — 38/38
      passed
      - `pnpm test-start-turbo
      test/production/app-dir/barrel-optimization/mui/index.test.ts` — 1/1
      passed
      - `pnpm test-start-turbo
      test/e2e/app-dir/cache-components-allow-otel-spans/cache-components-allow-otel-spans.test.ts`
      — 4/4 passed
      - `pnpm test-start-turbo
      test/e2e/404-page-custom-error/404-page-custom-error.test.ts
      test/e2e/app-dir/app-esm-js/index.test.ts
      test/e2e/app-dir/app-esm-js/standalone.test.ts` — 9/9 passed
      - Existing materialized-namespace fixtures verify namespace values, key
      enumeration, dynamic imports, CommonJS consumers, and liveness through
      the locals module
      - A callable CommonJS namespace fixture regression-tests the compact
      registration path after facade materialization
      - The full execution suite specifically caught and now covers pruned
      locals references and merged evaluation-only locals references in the
      generic #98617 implementation
      
      ### Bundle-size measurements
      
      Incremental effect of enabling `turbopackMangleExportNames` on this
      stack. Both sides use the same native binary and retain #98617's compact
      re-export registration; only mangling is toggled. Client reports raw and
      deterministic gzip (`gzip -9 -n`, sorted files); server reports raw only
      because Node.js consumes server code uncompressed. JavaScript files
      only; source maps, CSS, and license sidecars are excluded.
      
      #### Scope hoisting disabled
      
      | benchmark | client raw | client gzip | server raw |
      | --- | ---: | ---: | ---: |
      | `basic-app` | −17,380 B | −1,131 B | −61,155 B |
      | `heavy-npm-deps` *(three-dependency variant: lodash + Mantine +
      Mermaid)* | −47,537 B | −6,720 B | −82,326 B |
      | `module-cost` | −223,816 B | −2,113 B | −596,419 B |
      
      #### Scope hoisting enabled
      
      | benchmark | client raw | client gzip | server raw |
      | --- | ---: | ---: | ---: |
      | `basic-app` | −22,658 B | −7,634 B | −32,805 B |
      | `heavy-npm-deps` *(three-dependency variant: lodash + Mantine +
      Mermaid)* | −14,118 B | +1,291 B | −20,956 B |
      | `module-cost` | +30 B | −785 B | −7,265 B |
      
      The `heavy-npm-deps` rows use a modified benchmark fixture with Mantine
      and Mermaid enabled alongside lodash; the committed fixture enables
      lodash only. Positive/near-zero configurations were repeated and
      reproduced byte-for-byte for every reported metric.
      
      <!-- NEXT_JS_LLM -->
      
      <!-- fleet ecdfa248-cd54-41ac-b4a2-c9d49e2a67ee -->
      
      ---------
      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>
      8b067039
    • Tobias Koppers's avatar
      test(dev): add dedicated compiler polling coverage (#97673) · e2e19c48
      Tobias Koppers authored
      ### What?
      
      Adds a dedicated development integration test for compiler file watching
      in polling mode under both webpack and Turbopack.
      
      It also removes obsolete `CHOKIDAR_USEPOLLING` / `CHOKIDAR_INTERVAL`
      variables from the unrelated `read-only-source-hmr` suite, which remains
      focused on read-only source semantics and normal watcher behavior.
      
      Stack: **5/5** · Previous: #98737
      
      ### Why?
      
      Next.js did not have an e2e/development test dedicated to
      `watchOptions.pollIntervalMs`. Existing Rust coverage checks watcher
      modes, while the filesystem-watcher fuzzer is manual rather than part of
      the normal development-test matrix.
      
      The test also regresses notify-rs/notify#981. Older PollWatcher versions
      stored ordinary-file mtimes at whole-second precision, so a second edit
      in the same second compared equal and was permanently dropped. The
      preceding stack layer upgrades to `notify 9.0.0-rc.5`, which preserves
      nanosecond precision for regular files without content hashing.
      
      ### How?
      
      The dedicated pages-directory fixture configures only
      `watchOptions.pollIntervalMs`:
      
      - webpack maps it to compiler `watchOptions.poll`;
      - Turbopack passes it to notify and selects PollWatcher.
      
      It intentionally does not set `WATCHPACK_POLLING`, create/delete routes,
      or test the dev-server route watcher, keeping the test focused on
      compiler-level polling.
      
      The test writes two versions of an already-loaded page with controlled
      mtimes at +100 ms and +200 ms inside the same future whole second. It
      waits for the first HMR update before making the second write, requiring
      two distinct watcher events rather than allowing changes to coalesce.
      
      A negative control with the older npm-provided native binary observes
      the first update but permanently misses the second. A fresh local native
      build from the full stack passes both updates. The dedicated test and
      `read-only-source-hmr` pass under both Turbopack and webpack; Prettier
      and ESLint also pass.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 6488265d-2685-49d3-b632-6511b4b47690 -->
      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 avatarBenjamin Woodruff ‮ <180404+bgw@users.noreply.github.com>
      e2e19c48
    • Tobias Koppers's avatar
      build(turbopack): upgrade notify to 9.0.0-rc.5 (#98737) · 57ea96fa
      Tobias Koppers authored
      ### What?
      
      Upgrades the Turbopack filesystem-watcher dependency from `notify 8.1.0`
      to the published `9.0.0-rc.5` release candidate.
      
      Stack: **4/5** · Previous: #98863 · Next: #97673
      
      ### Why?
      
      notify-rs/notify#981 fixes PollWatcher dropping multiple edits to the
      same regular file within one second. The old implementation stored file
      mtimes at whole-second precision; with content hashing disabled, a
      second write in the same second compared equal and produced no event.
      This is the root cause behind #96982.
      
      rc.5 keeps nanosecond mtime precision for ordinary files without
      enabling content hashing. It remains a pre-release, so the pin should be
      revisited when notify 9.0 stable is available.
      
      ### How?
      
      The workspace dependency is pinned to exactly `9.0.0-rc.5`, and Cargo
      regenerates the lockfile. No Rust source compatibility changes are
      required: `turbo-tasks-fs` uses a narrow notify API surface and does not
      rely on removed APIs.
      
      The lockfile update includes notify's current backend dependencies
      across Linux, macOS, and Windows; cross-platform CI remains important
      because local runtime verification is Linux-only.
      
      ### Filesystem-watcher fuzzer impact
      
      The preceding stack layer adds `--poll-interval-ms` to `turbo-tasks-fuzz
      fs-watcher`, which provides a direct before/after control for this
      dependency update. Using a 100 ms polling interval, a 1,000 ms
      observation window, and no directory recreation:
      
      | Fuzzer mode | notify 8.1.0 | notify 9.0.0-rc.5 |
      | --- | --- | --- |
      | `--track-read-writes` | **230/288 iterations had mismatches** over
      five minutes | **0/291 iterations had mismatches** over five minutes |
      | ordinary reads | same-second changes can be missed depending on timing
      | **0 missing invalidations across 295 iterations** over five minutes |
      
      The read/write mode is the strongest comparison: it repeatedly produces
      an external edit after a read-derived write in the same-second window,
      so notify 8 fails consistently while rc.5 remains clean.
      
      Two findings are intentionally unchanged by this PR:
      
      - polling symlink mutations can still be missed within one second
      because rc.5 retains whole-second mtime precision for non-files; the
      fuzzer documents this limitation;
      - directory recreation can produce recoverable `PathNotFound`
      diagnostics while PollWatcher scans deleted subtrees. A 60-second
      resilience run completed 500 iterations with no panic or terminal error.
      
      A fresh native SWC/Turbopack build also passes the upper integration
      suite's rapid subsecond HMR case without timestamp workarounds.
      
      Fixes #96982
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 6488265d-2685-49d3-b632-6511b4b47690 -->
      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 avatarBenjamin Woodruff ‮ <180404+bgw@users.noreply.github.com>
      57ea96fa
    • Tobias Koppers's avatar
      test(turbopack): add polling to filesystem watcher fuzzer (#98863) · 946d560a
      Tobias Koppers authored
      ### What?
      
      Adds an opt-in polling mode to the manual `turbo-tasks-fuzz fs-watcher`
      stress harness through `--poll-interval-ms`.
      
      Stack: **3/5** · Previous: #98983 · Next: #98737
      
      ### Why?
      
      The fuzzer previously exercised only native filesystem events. A
      configurable polling mode enables sustained stress testing of
      PollWatcher invalidation behavior and provides a direct before/after
      control for the notify upgrade in the next stack layer.
      
      ### How?
      
      A positive, nonzero interval is mapped to
      `DiskWatcherConfig.poll_interval`; omitting it preserves the
      native-watcher defaults. The fuzzer passes an empty `DiskFileSystemMap`,
      matching the default `DiskFileSystem::new` behavior while using the
      extended constructor needed for watcher configuration.
      
      Manual runs cover ordinary reads, tracked read-derived writes,
      recursive/nonrecursive modes, directory recreation, and native omission.
      CLI help also documents that notify's PollWatcher retains whole-second
      mtime precision for non-files, so multiple symlink changes within one
      second can be missed; this upstream limitation is reported rather than
      hidden with timing workarounds.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 6488265d-2685-49d3-b632-6511b4b47690 -->
      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 avatarBenjamin Woodruff ‮ <180404+bgw@users.noreply.github.com>
      946d560a
    • Tobias Koppers's avatar
      test(turbopack): fix filesystem watcher symlink expectations (#98983) · 4ed2f4f3
      Tobias Koppers authored
      ### What?
      
      Makes the filesystem-watcher fuzzer's expected symlink invalidations
      reflect net target changes over each iteration.
      
      Stack: **2/5** · Previous: #98982 · Next: #98863
      
      ### Why?
      
      Symlink indices are sampled with replacement, so one link may be changed
      multiple times before the dependent task re-reads it. A later mutation
      can restore the iteration-start target. The old expectation retained
      that path after the first intermediate mutation and incorrectly reported
      a missing invalidation even though the task observed no net value
      change.
      
      ### How?
      
      The fuzzer snapshots symlink targets at the iteration boundary and
      removes expected paths whose final target matches the snapshot. All
      unlink/recreate operations and watcher timing remain unchanged; only the
      expected observable result is reconciled.
      
      Behavioural tests cover untouched links, restored targets, repeated
      mutations, and genuine net changes. Five-minute recursive and
      nonrecursive directory-symlink runs complete without missing
      invalidations.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 6488265d-2685-49d3-b632-6511b4b47690 -->
      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 avatarBenjamin Woodruff ‮ <180404+bgw@users.noreply.github.com>
      4ed2f4f3
    • Tobias Koppers's avatar
      test(turbopack): fix filesystem watcher read-write tracking (#98982) · ab6e1f62
      Tobias Koppers authored
      ### What?
      
      Replaces the filesystem-watcher fuzzer's obsolete pure-write tracking
      mode with a tracked read-derived write mode.
      
      Stack: **1/5** · Next: #98983
      
      ### Why?
      
      Pure write effects are no longer watcher dependencies after #92300
      removed write-invalidation tracking and added effect-value
      deduplication. The old fuzzer mode therefore expected behavior the
      runtime intentionally does not provide and reported mismatches on every
      iteration.
      
      ### How?
      
      The new mode reads each regular-file path to establish a real watcher
      dependency, then writes an idempotent value derived from the observed
      external content. An external edit changes the derived effect value, so
      the task reruns without restoring removed product semantics or entering
      a write/invalidation loop. Symlinks remain read-tracked.
      
      The content transformation has focused behavioural tests, and
      recursive/nonrecursive stress runs complete without mismatches.
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 6488265d-2685-49d3-b632-6511b4b47690 -->
      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 avatarBenjamin Woodruff ‮ <180404+bgw@users.noreply.github.com>
      ab6e1f62
    • Andrew Clark's avatar
      Don't re-request the App Shell to upgrade an ISR fallback (#94808) · 6302e6a9
      Andrew Clark authored
      When a page hasn't been prerendered with concrete params yet, the server
      answers a per-segment prefetch with the fallback shell and flags it as
      upgradeable, and the client records that on the cache entries so a later
      prefetch of the same route can retry and pick up the concrete prerender
      once the server has generated it. The scheduler runs that retry from its
      Fulfilled-entry branch: any prefetch task that finds an
      upgradeable-fallback entry and hasn't retried yet spawns a revalidation
      for its own URL.
      
      That's right for the concrete static walk, where the retry can bring
      back the param-dependent content the fallback omitted. It's wrong for
      the Shell-phase walk under Partial Prefetching. A shell request asks for
      shell-stage content, and the fallback render already produced all of it:
      a concrete prerender's shell stage omits the same param-dependent
      content the fallback omitted, so the retry can only return the shell the
      cache already has.
      
      This shows up with root params. The shell varies only on the root params
      it reads, so a shell fetched for `/en/uk/posts/1` whose root layout
      reads `lang` but not `region` is keyed with `region` as a fallback, and
      a link to `/en/gb/posts/1` finds it in the cache. With the retry gate
      on, revealing that link re-requested the identical shell, once per link
      whose root params the shell doesn't read.
      
      The fix gates the ISR fallback retry on the walk's strategy, next to the
      Pending and Rejected branches that already skip revalidations during a
      static shell attempt. The per-task retry loop that the original fallback
      response starts is unchanged.
      
      The included test reveals three links from `/en/us`: `/en/uk/posts/1`
      fetches the shell, `/en/gb/posts/1` (same `lang`, different `region`)
      fetches nothing, and `/fr/uk/posts/1` (different `lang`) fetches a new
      shell.
      
      This PR originally narrowed the shell's cache key to the root params the
      server reported. That change landed separately in "Convert per-segment
      prefetches to NavigationFlightResponse format" (#96877); rebasing onto
      it left the test, which then caught this.
      
      <!-- NEXT_JS_LLM_PR -->
      6302e6a9
    • Josh Story's avatar
      Fix unstable ensure static task annotation (#99075) · a10b283d
      Josh Story authored
      ## Summary
      
      Fix the obsolete `trace_ignore` field annotation on
      `unstable_ensure_static`.
      
      This restores `next-core` native compilation after the `TraceRawVcs`
      removal renamed the remaining field-assertion escape hatch to
      `unsafe_ignore`.
      
      ## Verification
      
      - `cargo fmt --all -- --check`
      - `cargo check -p next-core`
      - Not run: `pnpm build-all` (the managed worktree lacks per-package
      `node_modules`, so the command stopped before compiling the changed
      code)
      
      <!-- NEXT_JS_LLM -->
      a10b283d
  2. 22 Sep, 2026 11 commits
    • Josh Story's avatar
      test: update React 18 hydration error snapshots (#99073) · de3d0305
      Josh Story authored
      ## What
      
      Updates the React 18 Pages Router hydration-error inline snapshots to
      match the compact rendered-tree excerpts introduced by #99008.
      
      This is a test-only change. The runtime output is already intentional
      and is shared by webpack and Turbopack.
      
      ## Why this was missed
      
      React 18 jobs are opt-in for pull requests through the
      run-react-18-tests label. #99008 did not have that label, so its React
      18 snapshot branches were not exercised before merge.
      
      ## Verification
      
      - NEXT_TEST_REACT_VERSION=18.3.1 pnpm test-dev-webpack
      test/development/acceptance/hydration-error.test.ts — 15 passed, 12
      snapshots passed
      - NEXT_TEST_REACT_VERSION=18.3.1 pnpm test-dev-turbo
      test/development/acceptance/hydration-error.test.ts — 15 passed, 12
      snapshots passed
      - Prettier and git diff --check
      de3d0305
    • Luke Sandberg's avatar
      Remove redundant unsafe_ignore annotations (#98961) · 14ddf68e
      Luke Sandberg authored
      ## What?
      
      Remove 54 redundant `#[turbo_tasks(unsafe_ignore)]` field annotations,
      reducing the field-annotation total from 136 to 82 (39.7%). Fields that
      no longer carry the exemption now participate in the generated
      `NonLocalValue` or `OperationValue` assertions.
      
      This is stacked on #98953, which renames the former tracing attribute to
      `unsafe_ignore` and leaves it solely as a marker-trait assertion escape
      hatch.
      
      ## Why?
      
      Most annotations predated the removal of `TraceRawVcs` and were only
      needed to exclude fields from recursive VC tracing. Keeping those
      exemptions would unnecessarily bypass compile-time marker checks after
      tracing is gone.
      
      The remaining annotations fall into these categories:
      
      - 47 foreign, standard-library, or runtime types that cannot receive
      marker implementations because of Rust's orphan rules
      - 29 workspace-local helper or state types that do not currently
      implement the marker
      - 4 unconstrained trait objects or opaque futures
      - 1 local `OperationValue` contract gap
      - 1 macro fixture that tests the exemption itself
      
      The local helper/state group is the meaningful follow-up area; unlike
      foreign types, those types could gain separately reviewed marker
      implementations in their owning crates.
      
      ## How?
      
      Every field exemption was evaluated against the existing generated
      marker assertions. An annotation is removed only when the field already
      satisfies the appropriate marker bound. `debug_ignore` remains intact
      where it serves an independent purpose.
      
      No new `unsafe impl`, wrapper type, macro opt-out, or weakened assertion
      is introduced, so this change removes redundant unsafety rather than
      relocating or widening it.
      
      ## Verification
      
      - `cargo check --workspace --all-targets`
      - `cargo fmt --all -- --check`
      - `cargo test -p turbo-tasks-macros-tests`
      - `cargo test --doc -p turbo-tasks`
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 6de62cf9-27cd-4f08-8fce-7d495c71e7e8 -->
      
      ---------
      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>
      14ddf68e
    • Luke Sandberg's avatar
      Remove TraceRawVcs (#98953) · 157be190
      Luke Sandberg authored
      ## What?
      
      Remove the repository-wide `TraceRawVcs` trait, implementations, bounds,
      and derive support. Persistent-to-transient task errors now report the
      parent and callee names without recursively inspecting task inputs.
      
      The existing field-assertion escape hatch is renamed from `trace_ignore`
      to `unsafe_ignore`. It remains available to `NonLocalValue` and
      `OperationValue`, making its remaining purpose explicit without
      retaining a connection to tracing.
      
      The stripped release `next-napi-bindings` binary decreases by 307,648
      bytes (0.301%), from 102,325,280 to 102,017,632 bytes.
      
      ## Why?
      
      `TraceRawVcs` was introduced for a garbage-collection design that is no
      longer being pursued. Its only remaining runtime benefit was a more
      detailed version of an extremely rare diagnostic, which did not justify
      maintaining tracing implementations across the Rust workspace.
      
      ## How?
      
      The tracing module and proc macro are removed along with generated and
      manual implementations. APIs that previously required tracing now keep
      only the bounds they actively need. The backend diagnostic retains
      actionable task names while dropping its recursive cause graph, and the
      transient-collectible coverage is updated for the simplified message.
      
      ## Verification
      
      - `cargo fmt --all -- --check`
      - `cargo check --workspace --all-targets`
      - `cargo test -p turbo-tasks-backend --test transient_collectible`
      - `cargo test -p turbo-tasks-macros-tests`
      - `cargo test --doc -p turbo-tasks`
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 6de62cf9-27cd-4f08-8fce-7d495c71e7e8 -->
      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>
      157be190
    • Luke Sandberg's avatar
      test(turbopack): remove remaining test unmarks (#98376) · a24f9e4d
      Luke Sandberg authored
      ### What?
      
      Remove all 14 remaining non-API
      `unmark_top_level_task_may_leak_eventually_consistent_state()` calls
      from Turbopack tests across eight files. The manual mark/unmark
      consistency test remains unchanged because it intentionally covers this
      API.
      
      ### Why?
      
      Top-level test reads should state their consistency boundary explicitly
      instead of globally permitting eventually consistent state. Removing the
      suppressions makes accidental eventual reads fail normally and keeps
      each test aligned with production consistency rules.
      
      ### How?
      
      Use coarse operation roots for collectible and recomputation scenarios
      where the operation can settle, and narrower phase boundaries for tests
      that mutate dependencies. Preserve graph-sensitive behavior by
      extracting task IDs without resolving in parent-count tests and by
      strongly reading the existing leaf root without inserting wrapper
      parents in GC tests. Error tests use separate operation and plain-future
      helpers so their expected context stacks remain unchanged.
      
      ### Verification
      
      - `cargo fmt --all -- --check`
      - `timeout 300 cargo test -p turbo-tasks-backend --test parent_count
      --test trait_ref_cell_mode --test recompute_collectibles --test
      recompute --test collectibles --test errors --test immutable --test
      gc_collection` (36 passed)
      - `git diff --check`
      
      <!-- NEXT_JS_LLM -->
      
      <!-- fleet 475180cd-06a7-4669-89b5-a2029a3a18c9 -->
      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>
      a24f9e4d
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.39 · 12374810
      next-js-bot[bot] authored
      12374810
    • Janka Uryga's avatar
      [PPF] Scaffold `unstable_ensureStatic` segment config (#98190) · c6f9d9c8
      Janka Uryga authored
      Adds the necessary plumbing and validation for a `unstable_ensureStatic`
      segment config, allowing `"auto" | "shell" | "prefetch" | "navigation" |
      false`
      
      Also dedupes some checks that we were doing for `instant` and
      `prefetch`, because `requireStatic` needs them too:
      - is not exported from a client module
      - is not used without Cache Components
      c6f9d9c8
    • Aurora Scharff's avatar
      [agent-feedback] Respect CI and telemetry opt-out (#99062) · a2470dbd
      Aurora Scharff authored
      ### What?
      
      Make automatic agent feedback respect CI, the user's Next.js Telemetry
      preference, and the existing remote kill switch. The managed
      instructions are omitted in CI or when telemetry is disabled, and the
      internal reporting command fails closed before returning the protocol.
      
      ### Why?
      
      Agent feedback should never open from CI and should share the user's
      telemetry opt-out. The existing Playground gate remains the remote
      emergency switch; this change makes the local entry points consistently
      honor the other safety conditions.
      
      ### How?
      
      - Gate managed feedback instructions on non-CI execution and enabled
      telemetry.
      - Gate the internal feedback command locally before checking the remote
      switch.
      - Preserve explicit `--dry-run` diagnostics without opening a browser.
      - Document the CI and telemetry behavior and cover it with focused
      tests.
      
      <!-- NEXT_JS_LLM -->
      a2470dbd
    • Andrew Clark's avatar
      Fix prefetch loop when a predicted route redirects (#98998) · fdcb7386
      Andrew Clark authored
      A full or runtime prefetch (e.g. `router.prefetch(url, { kind: 'full'
      })` or `<Link prefetch={true}>`) of a URL that matched a learned route
      pattern but is redirected by the server (e.g. `/docs/changelog` →
      `/changelog` while `/docs/alpha` renders `[collection]/[...slug]`)
      caused the client to re-issue the same prefetch indefinitely, at
      whatever rate the network allowed, until the tab was closed.
      
      When the server contradicts a route prediction, the client is supposed
      to remember that the URL shape can't be predicted and resolve it on the
      server from then on. We were storing this information
      (`hasDynamicRewrite`) in the wrong place: on the predicted route cache
      entry, rather than the optimistic routing table that's used to generate
      predictions.
      
      The fix moves the `hasDynamicRewrite` flag to the optimistic routing
      table so it applies to all subsequent optimistic routing predictions.
      
      Fixes #98345.
      
      <!-- NEXT_JS_LLM -->
      fdcb7386
    • Aurora Scharff's avatar
      Fix dev overlay header layout on small screens (#99049) · a18b9a58
      Aurora Scharff authored
      ## Summary
      
      On narrow screens, the dev overlay header clips the version/bundler
      badge and wraps “No issues” while hiding its horizontal scrollbar. Below
      768px, the header now wraps its items onto a second row when needed. The
      empty Issues tab stays visible, the version pill keeps its desktop
      dimensions and rounded shape, and the mobile header has balanced spacing
      above the tabs and below the pill. The wide-screen layout is unchanged.
      
      This changes the shared overlay header independently of #99002.
      
      ## Before / after
      
      Both images use the same /insight-only route at a 390 CSS-pixel
      viewport, captured directly in Chrome as PNGs. The empty Issues tab
      remains visible, and the version and bundler metadata move to a balanced
      second row.
      
      <table>
        <thead>
          <tr>
            <th>Before</th>
            <th>After</th>
          </tr>
        </thead>
        <tbody>
          <tr>
      <td><img width="390" height="300" alt="Before: clipped version badge and
      wrapped empty Issues label at 390px"
      src="https://github.com/user-attachments/assets/a5e21308-0be1-4cb3-b4a8-101b3b793ff3"
      /></td>
      <td><img width="390" height="300" alt="After: balanced wrapped header
      and fully visible rounded version pill at 390px"
      src="https://github.com/user-attachments/assets/9bcd65cf-bdf3-402e-b121-0c66f0d63800"
      /></td>
          </tr>
        </tbody>
      </table>
      
      ## Wider screens — after
      
      The header stays on one row at both widths, with no horizontal overflow.
      The version pill retains its desktop dimensions and styling.
      
      **768px viewport**
      
      <img width="768" height="300" alt="After at 768px: navigation and
      version pill fit on one row"
      src="https://github.com/user-attachments/assets/f8994ca2-6d90-469a-b0df-a9d37165d838"
      />
      
      **1280px viewport** (cropped to the overlay)
      
      <img width="1000" height="300" alt="After at 1280px: unchanged desktop
      header layout"
      src="https://github.com/user-attachments/assets/e27eef41-d477-42f7-bcf3-224a1675e919"
      />
      
      ## Verification
      
      - `pnpm test-dev-turbo
      test/development/app-dir/instant-insights-tab-overlay/instant-insights-tab-overlay.test.ts`
      — all 5 tests passed.
      - Browser checks at 390, 768, and 1280 CSS-pixel widths confirm that the
      empty Issues tab remains visible, the pill keeps its 230.96 × 24px
      desktop dimensions and rounding, the mobile header has balanced spacing,
      and the wide-screen header remains on one row.
      - JavaScript build, formatting, and ESLint passed. Full `pnpm build-all`
      was attempted but blocked by the existing Rust workspace manifest error:
      `default-features = false` cannot override the workspace's
      `turbo-persistence` default features. Runtime verification used the
      published canary.38 native binary.
      
      <!-- NEXT_JS_LLM -->
      a18b9a58
    • Janka Uryga's avatar
      [PPF] Separate tracking of runtime data accesses for shells and prefetches (#98129) · e1131ee7
      Janka Uryga authored
      Expands the static tracking from #96095 to track shells and prefetches
      separately. We split the `ShouldAttemptStaticPrefetch` hint into
      `ShouldAttemptStaticShell` and `ShouldAttemptStaticPrefetch`, which the
      client router considers separately depending on whether we need a shell
      or a prefetch.
      
      The server-side tracking of `needsRuntimeRequest` becomes a bit more
      subtle.
      
      First, a runtime data access should only affect the shell if we're in
      the `ShellStatic` render stage. If we're already in the `PrefetchStatic`
      stage, then that content is not conceptually part of the shell, and
      should not deopt the shell to runtime, so we only unset
      `shouldAttemptStaticShell` if we're still in the shell stage.
      
      Second, accessing data that would only resolve in the prefetch (params,
      search params, short-stale caches) should **not** affect whether the
      shell can be static. `makeRuntimeDataHangingPromise` has been split into
      variants that match this:
      - `makeSessionDataHangingPromise` - data that affects the shell (and the
      prefetch), e.g. `cookies()`
      - `makeURLDataHangingPromise` - data that only affects the prefetch,
      e.g. `params`
      - `makeUnknownRuntimeDataHangingPromise`, used for private caches -- we
      omit these during build so we don't know whether they should affect the
      shell or only the prefetch, so we conservatively affect both (unless a
      private cache is only used in the prefetch stage)
        
      The server-side `needsRuntimeRequest` promise is now resolved such that
      data that only resolves in the prefetch does not affect the shell. If
      we're accessing data that only resolves in the prefetch, we will delay
      the promise's resolution to the `PrefetchStatic` stage, which means that
      when the client rewinds the static response to a shell, it will see an
      unresolved promise and consider the response as not having used runtime
      data. (see `markRuntimeDataAccessWhenStageReached`)
      e1131ee7
    • Sebastian "Sebbie" Silbermann's avatar