1. 08 Sep, 2026 20 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.22 · 6cb63960
      next-js-bot[bot] authored
      6cb63960
    • Jimmy Miller's avatar
      Add version for loaders api (#98377) · 1574d39e
      Jimmy Miller authored
      I looked into it. This is webpack's current version and the apis we are
      approximating.
      1574d39e
    • Luke Sandberg's avatar
      turbo-tasks-backend: let a GC pass wind down when it is blocking an operation (#96676) · 2994f6be
      Luke Sandberg authored
      A GC pass holds total operation exclusion, so every invalidation, cell
      update and child connect
      blocks for its whole duration. In dev that is an HMR edit stalled behind
      the cascade, and the pass
      had no way to notice or yield.
      
      This makes a gc pass interruptible so we are guaranteed to not stall too
      much work. To ensure progress we have a minimum guaranteed execution
      time `100ms`
      2994f6be
    • Aurora Scharff's avatar
      docs: preserve Next.js development state (#98276) · 552dd353
      Aurora Scharff authored
      ## Summary
      
      Explain in the Building guide that `.next/dev` contains the active
      development server state and incremental compilation caches. Deleting or
      moving `.next` makes the development server recreate that state, while a
      separate `distDir` provides isolated production output.
      
      Make the `next-dev-loop` Skill explicit that moving `.next` to a backup
      is still a reset. Keep the AI coding agents guide focused on discovering
      and inspecting the running development server.
      
      Update the agentic regression eval so it leaves two working routes and
      their development server running before introducing an invalid
      `generateStaticParams` signature. The production error points into
      `.next/types`, but the source contains the defect. The eval
      independently checks that the agent fixes the source, preserves `.next`,
      and verifies the result through the existing development session.
      
      ## Eval results
      
      | Model | Treatment | Result | Source fix | Preserve `.next` | Existing
      dev verification |
      | --- | --- | --- | --- | --- | --- |
      | GPT-5.6 Luna | Baseline | 1/3 | Fail | Fail | Pass |
      | GPT-5.6 Luna | Bundled Guide via `AGENTS.md` | 2/3 | Pass | Fail |
      Pass |
      | GPT-5.6 Luna | `next-dev-loop` Skill | 3/3 | Pass | Pass | Pass |
      
      The baseline tried to clear `.next`, moved it aside when deletion was
      blocked, and did not leave a valid source fix. The Guide treatment read
      the relevant `generateStaticParams` API reference and fixed the source,
      but still moved `.next` because it did not retrieve the general Building
      guide. The Skill treatment read the explicit preservation guidance, kept
      the original `.next` directory and development server active, used a
      separate `distDir` for the production build, and verified both routes
      through the running app.
      
      ## Verification
      
      - `pnpm --filter=next build`
      - Agentic eval with GPT-5.6 Luna: baseline, bundled Guide, and
      `next-dev-loop` Skill
      - Prettier and ESLint checks on the changed files
      - `git diff --check`
      
      <!-- NEXT_JS_LLM -->
      552dd353
    • Jimmy Miller's avatar
      Adds .resolve to loaders api (#98361) · afb0dbac
      Jimmy Miller authored
      This fully fixes handlebars loader in my tests and a number of other
      loaders depend on this as well. The implementation for getResolve is a
      bit different in turbopack, but this should be semantically the same.
      afb0dbac
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.21 · 74d9f775
      next-js-bot[bot] authored
      74d9f775
    • Niklas Mischkulnig's avatar
      Bump to swc v78 (#98268) · 84d55c5f
      Niklas Mischkulnig authored
      Notably, switches to the upstream React Compiler crates, as opposed to
      the `forked-react-compiler`
      84d55c5f
    • Janka Uryga's avatar
      Create next.config.ts when generating apps with `pnpm new-test` (#98364) · db66a509
      Janka Uryga authored
      Updates the template used by `pnpm new-test` for app-dir tests to create
      a `next.config.ts` instead of `next.config.js`.
      db66a509
    • Aurora Scharff's avatar
      test(evals): accept LayoutProps in App Router migration (#98365) · 4a34974e
      Aurora Scharff authored
      ### What?
      
      Updates the App Router migration eval to accept the generated
      LayoutProps helper as valid typing for root layout children.
      
      ### Why?
      
      The current docs support both an inline ReactNode annotation and the
      globally available LayoutProps helper. Opus 5 followed that guidance in
      all four AGENTS.md runs, but the eval rejected LayoutProps and reported
      a false regression.
      
      ### How?
      
      The assertion still requires children and now accepts either documented
      type form.
      
      ### Testing
      
      - Prettier check
      - ESLint
      - Focused assertion check covering both valid forms and an untyped
      invalid form
      
      <!-- NEXT_JS_LLM -->
      4a34974e
    • Hendrik Liebau's avatar
      [test] Run deploy tests against local JavaScript changes by default (#98353) · c11c0942
      Hendrik Liebau authored
      Deploy tests now use the checkout's built JavaScript packages when
      `NEXT_TEST_VERSION` is unset. The harness reuses the isolated-test
      packer, includes the tarballs in the deployment source, and installs
      them through relative `file:` references.
      
      The previous published-build workflow remains available through
      `NEXT_TEST_VERSION`. For example, `NEXT_TEST_VERSION=canary` skips local
      packing and tests the published canary. Exact versions and CI preview
      tarball URLs remain supported. Existing CI deploy jobs already set
      `NEXT_TEST_VERSION`, so their package selection does not change. The
      harness skips local package preparation when it reuses an existing
      deployment or invokes a custom deploy script, preserving those
      workflows.
      
      Staged monorepo peer dependencies use matching local versions so npm
      accepts prerelease builds without conflicting direct-package overrides.
      Fixture overrides retain their nested rules, including qualified
      identity overrides with or without an explicit `.` entry. Configuration
      updates preserve linked source files.
      
      Deployments of local JavaScript packages use published SWC binaries
      matching the local Next.js version. They do not include locally built
      native binaries because those may target a different platform.
      
      **Verification**
      
      ```
      VERCEL_TURBOPACK_TEST_TEAM=vtest314-next-turbo-e2e-tests \
        pnpm test-deploy-turbo test/e2e/app-dir/third-parties/basic.test.ts
      ```
      
      ```
      VERCEL_TEST_TEAM=vtest314-next-turbo-e2e-tests \
        pnpm test-deploy-webpack test/e2e/app-dir/third-parties/basic.test.ts
      ```
      
      Both deploy modes passed. Additional temporary checks, removed
      afterward, verified that:
      
      - Deployments install the local JavaScript packages and use matching
      local versions for monorepo peers.
      - Qualified npm overrides preserve a nested `sharp@0.34.5` pin, both
      with and without an explicit `.` entry. The check resolved `sharp` from
      Next's own dependency context.
      - Archive preparation leaves checkout manifests and tarballs unchanged.
      Repacked archives preserve other package files, permissions, links, and
      external peer declarations.
      c11c0942
    • Sebastian "Sebbie" Silbermann's avatar
      [test] Resolve `workspace:*` packages to the version under test (#98330) · 662b0355
      Sebastian "Sebbie" Silbermann authored
      Test fixtures that depend on monorepo packages (for example
      `@next/third-parties` and `@next/mdx`) declared them at the `canary`
      dist-tag, which installs the published npm canary instead of the build
      under test. In deploy tests this also broke the remote install entirely:
      the published canary's `peerDependencies` ranges (for example
      `^16.0.0-beta.0`) reject the prerelease preview versions that
      `NEXT_TEST_VERSION` installs for `next` (for example
      `16.4.0-preview-<sha>-<date>`), so `npm install` failed with ERESOLVE.
      
      Test dependencies can now be declared as `workspace:*`, which resolves
      to the build from the current checkout in every test mode:
      
      - dev/start: the locally packed tarball from `pack-for-isolated-tests`,
      with a descriptive error when the package has no pack task or is not
      part of the repository.
      - deploy: the preview tarball of the tested commit when
      `NEXT_TEST_VERSION` points at a preview build (preview tarballs already
      rewrite their monorepo peer dependencies to the same preview URLs, so
      peer resolution succeeds), falling back to the version in the worktree
      otherwise. Private packages without published preview tarballs fail with
      a descriptive error.
      
      All existing tests that used `canary` for monorepo packages are migrated
      to `workspace:*`.
      662b0355
    • Luke Sandberg's avatar
      turbo-tasks: explicit GC root anchoring + cross-session orphan reclamation (#96857) · 97e7d901
      Luke Sandberg authored
      ### What?
      
      Reworks how the reference-counting GC decides what is a **root** (a task
      that must not be collected), and adds a durable path to reclaim
      cross-session orphaned roots
      
      Currently GC roots are persisted and the only way to get collected is
      for another session to revive them, and then for their ref-counts to
      drop. This provides a new mechanism.
      
      1. **In-session** — Top level operations get reference counted so they
      can be dropped in session.
      2. **Cross-session** — live roots are recorded along with a simple aging
      mechanism so they can still be collected even if a later session never
      restores it.
      
      ### Why?
      This closes the final GC gap. Top level operations are ambiguous
      currently and need tracking. With cross session aging we close a basic
      gap where if you delete a route between sessions we never clean up the
      tasks. Now it will eventually age out.
      
      ### How?
      
      **Roots are anchored explicitly**. Via pins and RAII guards like
      `GcRoot`
      
      **Persisted roots set + TTL age-out** A new Infra-keyspace `GcRoots`
      entry persists `Vec<(TaskId, ttl)>`. That allows us to detect when roots
      are stale and can be dropped.
      
      **Dispose transient root tasks on drop.** `RootTask::Drop` now disposes
      tasks and cleans up references allowing the GC to work
      97e7d901
    • Janka Uryga's avatar
      [PPF] Fix missing runtime-follow up if hints are stale (#98278) · b0b7a429
      Janka Uryga authored
      if a page didn't use runtime data during build but started doing so
      after the revalidation (i.e. the hints say its statically-prefetchable
      but now it's not), we're supposed to be doing a follow-up runtime
      request based on the `needsRuntimeRequest` promise (introduced in
      #96095), but this was not actually happening.
      
      the bug goes as follows:
      1. if we get an entry from a static prefetch, but `needsRuntimeRequest`
      is true, we save it as `PPR` (or `StaticShell` if it's a shell rewound
      from the static response). otherwise, we'd have saved it as `PPRRuntime`
      (or `RuntimeShell` for shells) to indicate that it satisfies those
      requests.
      2. `wouldRuntimeRequestProvideMore` compares the runtime strategy for
      the current static walk to the entry's strategy to check if it should do
      a runtime request. this boils down to a comparison of `RuntimeShell >
      PPR` for a shell request
      3. however, in the `FetchStrategy` enum, `RuntimeShell = 2` and `PPR =
      3`, so `RuntimeShell > PPR` is false, which makes
      `wouldRuntimeRequestProvideMore` return `false`. so, if we have a `PPR`
      entry, **we'll never do a follow-up runtime shell request**.
      
      This is fixed by swapping the order of the two values in the enum.
      
      Now, if we end up with a `PPR` response where `needsRuntimeRequest` is
      true due to runtime data, that indicates that we *should've done a
      runtime request in the first place*, we just didn't know we should do so
      because the prefetch hint was stale, so the new ordering achieves the
      correct behavior, i.e. `pingSegmentBundle` decides that it needs a
      runtime shell request, which makes it match the intended PPF prefetching
      behavior.
      
      The enum ordering is a bit of a lie, because there is no single correct
      ordering -- a `PPR` entry *might actually provide more content* than a
      `ShellRuntime` entry if the route uses static params. In practice this
      is resolved by the vary path (shell responses are keyed with fallback
      params, and a PPR entry with static params would have the actual param
      values, and the param-ful entry would end up being preferred) so the
      strategy order wouldn't matter.
      
      Now that `RuntimeShell` beats `PPR`, i had to disable the strategy
      upgrading (`StaticShell -> RuntimeShell` and `PPR -> PPRRuntime`) on
      routes that don't use Partial Prefetching -- otherwise, a
      rewound`ShellRuntime` entry from a different param was winning over
      `PPR` in `pingSegmentBundle`, so it was preventing issuing new static
      requests even if we needed to do them. However, without PPF, the runtime
      tiers are not meaningful anyway, so this should be fine.
      
      ### Other bugs
      
      This fix also revealed a bug where `FetchStrategy.Full` requests were
      writing a shell as `RuntimeShell` even though the byte offset only marks
      a *static* shell. I've refactored the logic for picking the strategies
      to fix this and make it more explicit.
      
      ### Edge cases
      
      there is one (somewhat involved) edge case to this that i know of.
      if the post-revalidation static response has:
      
      1. a shell that didn't access runtime data (i.e. `needsRuntimeRequest =
      false` in the shell stage)
      2. a prefetch that did access runtime data (i.e. `needsRuntimeRequest =
      true` in the static stage)
      
      then we'll:
      
      1. write the shell as `ShellRuntime` (because `needsRuntimeRequest =
      false`, and a runtime shell would not in fact provide more data)
      2. write the prefetch as `PPR` (and not `PPRRuntime`, because
      `needsRuntimeRequest = true`, and a runtime prefetch *would* provide
      more data)
      
      with the new ordering, this means we'll end up preferring the
      `ShellRuntime` entry over the `PPR` entry even though the shell is a
      strict subset of it and would be missing static params and content gated
      behind `prefetch()` or `navigation()`. (note that this only happens if
      they share the same vary path)
      
      this can be observed as follows:
      1. when a `<Link prefetch={true}>` to such a page is revealed, we won't
      request a runtime shell (due to already having a `ShellRuntime` entry),
      but we will request a runtime prefetch (because `PPR` is not enough). so
      far this is correct
      2. if the navigation happens **before** this runtime prefetch completes,
      we will display what we already have. but we'll prefer the rewound
      `ShellRuntime` shell entry over than the `PPR` entry it originated from
      because of the enum ordering. so we may end up not showing content
      despite having it in the cache
      
      i'm not sure how to resolve this yet, but i think the current
      `recordedFetchStrategy` trick can't handle this, and we need a more
      involved mechanism that can detect when the `PPR` entry is actually
      better. i don't consider this a blocker for this fix though
      b0b7a429
    • Janka Uryga's avatar
      Instant validation for caches excluded from prerenders (#98342) · f4449e8f
      Janka Uryga authored
      Follow-up to #98339. Turns out we were not testing how caches excluded
      from static/runtime prerenders and app shells behave in Instant
      Validation, and it was somewhat broken. This PR adds test coverage and
      fixes some bugs I found along the way.
      
      ### Fixes
      
      - `use-cache-wrapper` was incorrectly gating cache delays in "request"
      stores on `NODE_ENV === "development"`, which does not include
      build-time instant validation. The correct check is now implemented in
      `isValidationRender`
      - `use-cache-wrapper` has divergent behavior for caches with `stale <
      MIN_SHELL_STALE` across app shells and PPR/static shells, which needs to
      be tracked so that we know that the same render can't be used for both
      Instant and Static Shell validation. When we see a cache entry like
      that, we now call `trackIncompatibleShellContent()`
      - A render that had a cache miss could still report that it's compatible
      with both SSV and IV, because we only do the above for a cache hit. As a
      result so we'd incorrectly reuse `LAZY_FULL_RENDER` for both. Cache
      misses now result in a `trackIncompatibleShellContent()` call to avoid
      this
      
      ### Tests
      
      We now have tests for:
      - `stale < MIN_SHELL_STALE` - excluded from app shells, but included in
      static and runtime prefetches
      - `stale < MIN_PREFETCHABLE_STALE` - excluded from all prerenders
      - `expire < MIN_PRERENDERABLE_EXPIRE` - excluded from static prerenders,
      but allowed in runtime prerenders
      
      Due to bugs mentioned above, some of the added tests were failing before
      the fixes (mostly the ones that expect an error -- passing a "no
      validation errors" test is easy, just don't create any dynamic holes)
      
      In build, these tests incorrectly reported no errors when they should've
      failed IV:
      
      - `invalid - unguarded non-prefetchable cache (with short stale)` (both
      PPF and non-PPF)
      - `non-app shell validation > invalid - unguarded non-prerenderable
      cache with short expire` in build:
      - `app shell validation > invalid - unguarded cache with a
      shorter-than-shell staleTime` in build:
      
      This is because we were missing cache delays in build-time instant
      validation (now fixed with `isValidationRender`), so the caches weren't
      dynamic holes at all.
      
      The `stale < MIN_SHELL_STALE` tests (`app shell validation > invalid -
      unguarded cache with a shorter-than-shell staleTime`) were also failing
      in dev:
      - **{initial load, client navigation} with cold caches**: Should be an
      IV error, but is an SSV error. The initial render had cache misses, so
      we did a warm-cache full rerender with runtime shells, which resolved
      `await nonShellCache()` in the Runtime stage. But the initial render
      **did not track incompatible data**, so we incorrectly re-used it for
      SSV and IV. The cache was resolved in `Runtime` so SSV saw a runtime
      hole and `await nonShellCache()` errored in SSV with `Next.js
      encountered runtime data during prerendering.`
      - **client navigation with warm caches**: same as above, except there
      weren't cache misses, so incorrectly reused the *original* runtime-shell
      render for SSV and IV
      - **initial load with warm caches**: No redbox when IV should've
      errored. The main render was an initial load and did not use runtime
      shells, so it resolved `await nonShellCache()` in `PrefetchStatic`. We
      had no cache misses and **did not track incompatible data**, so we
      incorrectly re-used the main non-runtime-shell render for SSV and IV.
      The cache resolved in `PrefetchStatic` and it wasn't a hole in
      `ShellRuntime` so no error was reported.
      f4449e8f
    • Janka Uryga's avatar
      [PPF] Model caches with `stale < MIN_SHELL_STALE` as prefetch-only data (#98339) · e974969d
      Janka Uryga authored
      Caches that have `stale < MIN_SHELL_STALE` were using
      `makeStageHangingPromise` in prerenders, which (in theory) was meant to
      track a runtime data access during a static prerender, which in turn
      would make the page use runtime shells. This is semantically incorrect,
      because both static and runtime shells would exclude the cache, and both
      static and runtime prefetches would include it, so it does not actually
      signal runtimeness, only prefetchness. The only thing we should be doing
      for these caches is excluding the content, same as
      `unstable_prefetch()`.
      
      This PR replaces `makeStageHangingPromise` with
      `makePrefetchHangingPromise`, which is not tracked as runtime data at
      all. We also use it for `unstable_prefetch()` to signal the
      correspondence.
      
      Note that in practice, the usage of `makeStageHangingPromise` in
      `use-cache-wrapper` was *technically* fine, because its runtime data
      tracking was effectively dead code. We only returned it if
      `stagedRendering.finalStage < stage`, but for static prerenders `stage =
      staticLinkDataStage = PrefetchStatic` and `finalStage = Static`, so the
      condition was never actually true, and we never actually tracked it as a
      runtime data access. However semantically it should still not be tracked
      as runtime data.
      (The condition *can* be true in a runtime prerender that only prerenders
      the shell. We don't do any tracking in runtime prerenders, so it was
      also a no-op).
      
      (this was extracted from #98129, where we separate runtime data access
      tracking into session data and URL data. i couldn't figure which one
      `makeStageHangingPromise` should be tracked as, but then i realized it
      shouldn't be tracked at all)
      e974969d
    • Joseph's avatar
      docs: document excluding content from a prefetch in the prefetching g… (#98175) · aab93871
      Joseph authored
      Guide introduction of unstable_prefetch and unstable_navigation.
      aab93871
    • Joseph's avatar
      docs: add unstable_navigation and unstable_prefetch API references (#98122) · 68e3fb1d
      Joseph authored
      Adds API reference pages for the two render-interruption functions, both
      marked `version: experimental`.
      
      - `unstable_navigation()`, which keeps a subtree out of a route's
      prefetches so it renders on the navigation.
      - `unstable_prefetch()`, which keeps a subtree out of a route's App
      Shell so it renders on a per-link prefetch or on the navigation.
      
      Each page opens with the App Shell, per-link prefetch, navigation
      ladder, states which boundary its function moves content past, and
      cross-references the sibling function and the Adopting Partial
      Prefetching guide.
      68e3fb1d
    • Jimmy Miller's avatar
      Fix turbopacks webpack loader setup to support options being optional (#98270) · 9d9e1d5b
      Jimmy Miller authored
      If you look at the types for webpacks loaders, you can see that options
      is optional.
      https://github.com/webpack/webpack/blob/c17742f631eaeaf1ad880a70b105eedd96dd21b9/declarations/LoaderContext.d.ts#L83
      
      The implementation between the two is slightly different so webpacks
      impementation doens't jsut set it to {}. But with the way turbopack
      works, this is the equivalent.
      
      I saw a bunch of failures all related to this in real loaders, so figure
      it was an easy quick fix.
      
      (also extensionOptions is optional in webpack and needed to be here for
      the the types to all checkout
      https://github.com/webpack/webpack/blob/c17742f631eaeaf1ad880a70b105eedd96dd21b9/declarations/WebpackOptions.d.ts#L2175)
      9d9e1d5b
    • Sebastian "Sebbie" Silbermann's avatar
      [ci] Align build-and-deploy triggers with build-and-test (#98331) · 665d3458
      Sebastian "Sebbie" Silbermann authored
      Change detection (`git diff HEAD~1`) only covers the whole change set
      when the checkout is the PR merge commit. `build-and-test` runs on
      `pull_request` while `build-and-deploy` ran on `push` for upstream PR
      branches, so a multi-commit push whose last commit was docs-only made
      `build-and-deploy` skip the preview build while deploy tests in
      `build-and-test` waited up to 30 minutes for a preview tarball that
      never got published.
      
      `build-and-deploy` now triggers on the same events as `build-and-test`
      (`push` to the default branch and `pull_request`), while still accepting
      release tags and workflow dispatch. The `deploy-target` fork guard is
      removed since upstream PRs are no longer covered by a push run, and
      `create-release-branch.js` now rewrites the workflow's branch list
      alongside the existing `refs/heads/canary` replacement so release
      branches keep their staging deploys.
      
      Preview tarball creation now uses the PR head sha instead of falling
      back to the merge-commit sha on `pull_request` `opened` events
      (`github.event.after` only exists on `synchronize`), matching the sha
      that `upload_preview_tarballs.yml` publishes under and that tests poll
      for. This fallback was a pre-existing bug that only affected fork PRs;
      it would have started affecting every upstream PR's first run once
      previews moved to the `pull_request` event.
      665d3458
    • Tobias Koppers's avatar
      test: stabilize server action HMR update (#98322) · 71672971
      Tobias Koppers authored
      ### What?
      
      Stabilize the development-mode server action HMR test when an unrelated
      Fast Refresh reload occurs while the patched action is being applied.
      
      ### Why?
      
      The test retried by dispatching another click before the previous
      asynchronous server action had settled. Under CI load, those requests
      overlapped with HMR and an unrelated full-page Fast Refresh reload. The
      reload reset the client counter, so the correctly updated action
      returned exactly `1000`, which the test rejected because it assumed the
      pre-reload state was preserved.
      
      ### How?
      
      Wait for network idle after each action invocation so retries do not
      observe an in-flight response, allow the valid post-reload value of
      `1000`, and use a retry window that accommodates CI HMR latency. The
      assertion still distinguishes the updated `+1000` action from the
      original `+1` implementation without requiring client state to survive
      an unrelated reload.
      
      ### Verification
      
      - `pnpm test-dev-turbo
      test/e2e/app-dir/actions/app-action-node-middleware.test.ts -t "should
      support updating the action"` (10 consecutive passes)
      - `pnpm test-dev-webpack
      test/e2e/app-dir/actions/app-action-node-middleware.test.ts -t "should
      support updating the action"` (4 consecutive passes)
      - Prettier and ESLint on `test/e2e/app-dir/actions/app-action.test.ts`
      
      <!-- NEXT_JS_LLM -->
      
      
      <!-- fleet 5793f439-a569-44be-ad19-d456ce9b641c -->
      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>
      71672971
  2. 07 Sep, 2026 5 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.20 · 969733cf
      next-js-bot[bot] authored
      969733cf
    • Luke Sandberg's avatar
      test(turbopack): remove dead top-level task unmarks (#98246) · 3453f7b6
      Luke Sandberg authored
      ## Summary
      
      Remove stale
      `unmark_top_level_task_may_leak_eventually_consistent_state()` calls
      from tests and a benchmark that already use strongly consistent
      operation-root reads.
      
      ## Verification
      
      - `cargo test -p turbo-tasks-backend --test detached --test eviction`
      - `cargo check -p turbo-tasks-backend --benches`
      - `cargo fmt --all -- --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>
      3453f7b6
    • Tobias Koppers's avatar
      Fix flaky successive HMR changes test (#97610) · e9c16094
      Tobias Koppers authored
      ### What?
      
      Correct the fixture marker used to construct the second invalid source
      state in the successive App Router HMR test.
      
      ### Why?
      
      The test was replacing a marker that does not exist in its MDX fixture.
      Because string replacement silently returned the original content,
      supposedly successive patches sometimes wrote byte-identical source
      while the test harness waited for an HMR completion callback.
      
      A no-op write does not have to produce an HMR update, so the callback
      could remain pending until the harness reported a misleading timeout. CI
      logs showed Fast Refresh itself completing quickly, which ruled out an
      insufficient timeout budget and made extending the timeout the wrong
      fix.
      
      ### How?
      
      Match the replacement to the fixture's actual marker. This restores four
      genuinely distinct source states in every error/recovery cycle,
      preserving the intended overlay coverage without changing Turbopack, the
      shared HMR helper, or its timeout.
      
      ### Verification
      
      - `pnpm test-dev-turbo
      test/development/acceptance-app/app-hmr-changes.test.ts`
      - Repeated the focused test three times under 14 CPU-contention workers
      - Prettier and ESLint on the changed test file
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      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>
      e9c16094
    • Joseph's avatar
    • Luke Sandberg's avatar
      turbo-tasks-backend: fix strongly consistent read hanging on a canceled task (#98312) · 549476b0
      Luke Sandberg authored
      ### What
      
      Fixes a shutdown hang in `next build`: a strongly consistent read could
      wait forever on a task that shutdown had canceled, which in turn blocked
      `stop_and_wait` and hung the build until the test timeout.
      
      Also makes the `hanging_detection` feature usable — it panics due to a
      `data` access check today.
      
      ### Why the read hangs
      
      1. Shutdown sets `stopped`. A task dispatched after that point is
      canceled before it runs, so it has no output.
      2. Its parent completes and connects its children.
      `process_new_children` uses `!child.has_output()` as the test for "not
      computed yet" and marks such a child `InitialDirty` so it gets
      scheduled.
      3. `make_task_dirty` promotes the canceled task's `SessionDependent` to
      plain `Dirty` and clears `current_session_clean`. That is correct for a
      live task that must re-run, and wrong for one that never will.
      4. `AggregatedDataUpdate::from_task` then snapshots `dirty_state() ==
      (true, false)` and contributes a dirty container that is not
      session-clean.
      5. The parent is itself clean, so its own `update_dirty_state(None ->
      None)` early-returns and never evaluates `all_clean_event`. Its
      dirty-container count never drains.
      6. The strongly consistent reader waits on that event forever, holding a
      foreground job that `stop_and_wait` blocks on.
      
      `has_output()` is a proxy for "needs computing", and a canceled task
      breaks that assumption.
      
      ### The fix
      
      Record a terminal error output when a task execution is canceled. 
      
      Make hanging_detection more reliable
      549476b0
  3. 05 Sep, 2026 2 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.19 · 4fed8eaf
      next-js-bot[bot] authored
      4fed8eaf
    • Dominik K's avatar
      fix: route info segment overrides not updating in dev overlay (#96968) · a8d18976
      Dominik K authored
      ## Summary
      
      Previously, when using the built-in route segment override in the
      Next.js dev tools (Route Info panel), the UI was not updating: after
      toggling a boundary (e.g. `loading.js` or `not-found.js`) you couldn't
      switch back unless you closed the modal and reopened it, which slowed
      down my workflow. It's not a huge issue, but I thought I'd fix it.
      
      The cause was the segment explorer trie mutating nodes in place, so the
      panel's memoized view never picked up insertions until remount. Trie
      updates now copy the nodes along the mutated path (copy-on-write) so
      changed nodes get fresh identities while untouched subtrees stay shared.
      
      ### Before
      
      Switching from one override to another works, but the UI doesn't update
      — you have to close and reopen the panel.
      
      
      https://github.com/user-attachments/assets/39e43ad7-2f14-4b54-bdab-eba51c87a060
      
      ### After
      
      Setting an override updates the DevTools UI immediately — no need to
      close and reopen the panel.
      
      
      https://github.com/user-attachments/assets/113887cf-fe07-4d9b-90a5-405b53692a07
      
      ## Verification
      
      - `pnpm jest
      packages/next/src/next-devtools/dev-overlay/segment-explorer-trie.test.tsx`
      - `pnpm test-dev-turbo
      test/development/app-dir/segment-explorer/segment-explorer.test.ts`
      - Manually verified in a dev app: toggling boundary overrides and "Clear
      Segment Overrides" now update the panel live.
      
      <!-- NEXT_JS_LLM -->
      a8d18976
  4. 04 Sep, 2026 7 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.18 · 6685283f
      next-js-bot[bot] authored
      6685283f
    • Xanaado's avatar
      Turbopack: fix `source` field in CSS sourcemaps (#88225) · 0ac302d3
      Xanaado authored
      Closes #88294
      
      
      Currently, CSS source maps in Turbopack always use index `0` for all
      source file references. This can lead to misleading mappings and makes
      debugging CSS generated from multiple sources more difficult.
      0ac302d3
    • Janka Uryga's avatar
      fix: track dynamic accesses in final runtime prerenders (#98255) · 00b29d66
      Janka Uryga authored
      The fix implemented in #95665 (`params/searchParams` not hanging
      correctly in Runtime App Shells during prospective prerenders) was
      incomplete. We started using `makeHanging[Search]Params` in the
      prospective prerender (if it was an app shell and wouldn't resolve
      them), but not during the final prerender. This meant that, when
      encoding the cache key, we would only fire `dynamicAccessAbortSignal` in
      the prospective prerender:
      
      
      https://github.com/vercel/next.js/blob/090f1b72753b2d0094235d27d46ffa0da5fc7d35/packages/next/src/server/use-cache/use-cache-wrapper.ts#L2160-L2174
      
      ...but the final prerender wasn't using `makeHanging[Search]Params`, so
      it would not hit this early exit. The hanging input abort signal would
      still correctly abort the key encoding (because it accounts for
      `stageController.finalStage`) so the key would still be partial, as
      expected. We would continue on, and attempt to look the key up in the
      Resume Data Cache. But the prospective prerender exited early and never
      put anything under that key, so we would incorrectly end up here, and
      log:
      
      
      https://github.com/vercel/next.js/blob/090f1b72753b2d0094235d27d46ffa0da5fc7d35/packages/next/src/server/use-cache/use-cache-wrapper.ts#L2730-L2734
      
      This is fixed by consistently using `makeHanging[Search]Params` if the
      runtime prerender won't reach the stage where they resolve, i.e. if it's
      an App Shell. This means we'll trigger `dynamicAccessAbortSignal` while
      encoding the cache key in *both* renders, so we'll do the early exit
      consistently and avoid the log.
      
      (This feels a bit unsatisfying, because ideally this would all just work
      based on stages, which is what I idealistically thought when writing the
      code originally. But unfortunately our usage of
      `dynamicAccessAbortSignal` for `params/searchParams` requires these
      special cases to work consistently. Maybe this can be improved in the
      future.)
      
      ### Tests
      
      This scenario is covered by the existing `prefetch-runtime` tests -- i
      discovered the bug by running them and seeing the `Unexpected cache miss
      after cache warming phase` warning. We now assert that the warning is
      not logged. The assertion is negative and would also pass if the error
      message changed, so i've exported the message as a constant to ensure
      `use-cache-wrapper` and the tests stay in sync.
      00b29d66
    • Joseph's avatar
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.17 · 1b5400c9
      next-js-bot[bot] authored
      1b5400c9
    • Hendrik Liebau's avatar
      Turn on the adapter route collapses by default (#98218) · cc27d89b
      Hendrik Liebau authored
      `experimental.collapseAdapterRoutes` now defaults to `true`, so a build
      serves several dynamic routes from one entry in the route table that it
      passes to an adapter. The default started off in #97774 so that the
      behavior could reach projects one at a time. We have tested this
      successfully internally, so the default moves back. The option stays in
      place, so a build that hits a regression can set it to `false` and get
      the table that a build emitted before the collapses.
      
      The four fixtures under `test/production/app-dir/adapter-dynamic-routes`
      no longer set the option, because the default now gives them the
      collapsed table that their snapshots record. The snapshots themselves do
      not change, since the new default produces what the explicit option
      produced.
      
      A full deploy test run with the flag on by default was already done as
      part of #97738.
      cc27d89b
    • Marcos Hernanz's avatar
      fix: suppress missing package manager errors in next info (#97946) · 090f1b72
      Marcos Hernanz authored
      ## What
      
      - capture stdout and stderr for both direct and shell-fallback
      package-manager version probes
      - keep successful version output unchanged and return `N/A` when a probe
      fails
      - add deterministic cross-platform regression coverage with a failing
      Yarn shim
      
      Closes #97932
      
      ## Why
      
      PR #71134 added an `execSync` fallback so package-manager command shims
      can be resolved on Windows. When `stdio` is omitted, Node mirrors stderr
      from failed synchronous child processes to the parent, so an unavailable
      Yarn or pnpm can print raw shell errors before `next info` reports
      `N/A`.
      
      Passing `{ stdio: "pipe" }` to both probes preserves captured stdout and
      the Windows fallback while keeping expected probe failures silent. The
      change stays scoped to package-manager version detection; shared
      registry discovery is unchanged.
      
      ## Testing
      
      - `pnpm --filter next typescript`
      - `pnpm --filter next build`
      - `pnpm test-types --pretty false`
      - ESLint and Prettier on both changed files
      - `pnpm test-start test/e2e/cli/cli.test.ts` (66 passed, 1 skipped)
      - built-CLI reproduction with npm available and Yarn/pnpm absent: both
      report `N/A` with no Yarn/pnpm command-not-found output
      - autoreview with GPT-5.6 Sol xhigh and Claude Opus 5 xhigh: zero
      findings
      
      ---------
      Co-authored-by: 's avatarvercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
      090f1b72
  5. 03 Sep, 2026 6 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.16 · 6b56068f
      next-js-bot[bot] authored
      6b56068f
    • Josh Story's avatar
      test: remove stale deploy manifest exclusions (#98051) · e82978ca
      Josh Story authored
      ## Summary
      
      Remove two inert entries from the deploy-test manifest:
      
      - the entry for
      `test/e2e/app-dir/options-request/options-request.test.ts`, which no
      longer exists
      - the `test/production/standalone-mode/**/*` glob, which cannot match
      the manifest's e2e-only include rule
      
      This leaves the hard exclusion list limited to live, selectable test
      suites so follow-up deploy-testing work starts from an accurate
      inventory.
      
      ## Verification
      
      - Parsed `test/deploy-tests-manifest.json` and confirmed all 26
      remaining exclusions resolve to files selected by the manifest's include
      rule.
      
      <!-- NEXT_JS_LLM -->
      e82978ca
    • Marcos Hernanz's avatar
      Enable hourly next-maintainer auto-close workflow (#98225) · 4fffc2c6
      Marcos Hernanz authored
      ## Summary
      
      - enable the existing auto-close workflow once per hour
      - keep manual dispatch available
      - leave the workflow logic and permissions unchanged
      
      ## Verification
      
      - production `workflow_dispatch` succeeded end to end:
      https://github.com/vercel/next.js/actions/runs/33788887152
      - production returned a clean empty-queue response after OIDC
      authentication and Vercel Trusted Sources validation
      - Prettier and `git diff --check` pass
      4fffc2c6
    • Josh Story's avatar
      Return client errors for unrecognized Server Actions (#98123) · 65c832c8
      Josh Story authored
      ## Summary
      
      - return `400 Bad Request` when a Server Action reference ID does not
      match the expected format
      - return `409 Conflict` when a well-formed action ID is unavailable in
      the current deployment, including deployment skew
      - apply the same classification to IDs from the `Next-Action` header and
      multipart MPA forms, including direct and bound actions in Node and Edge
      runtimes
      - return generic text bodies matching the client error category, without
      exposing action-ID details
      - derive marked forwarded-action responses from the original action ID
      so an unexpected or mixed-version worker response cannot change the
      client error semantics
      
      Fetch actions previously had dedicated 404 handling, while equivalent
      MPA form submissions fell through to the generic error path and returned
      500. This removes that transport-dependent behavior and distinguishes
      malformed or scanning traffic from legitimate stale clients without
      treating either case as a missing page or an internal server failure.
      
      ## Verification
      
      - `pnpm test-dev-turbo
      test/e2e/app-dir/actions-unrecognized/actions-unrecognized.test.ts`
      - `pnpm test-dev-turbo test/e2e/app-dir/actions/app-action.test.ts -t
      'forward.*action'`
      - `pnpm test-start-turbo
      test/e2e/app-dir/actions-unrecognized/actions-unrecognized.test.ts`
      - `pnpm test-dev-webpack
      test/e2e/app-dir/actions-unrecognized/actions-unrecognized.test.ts`
      - `pnpm test-dev-turbo
      test/e2e/app-dir/no-server-actions/no-server-actions.test.ts`
      
      <!-- NEXT_JS_LLM -->
      65c832c8
    • Marcos Hernanz's avatar
      Add Next Maintainer auto-close workflow (#98197) · 0eb4d7d5
      Marcos Hernanz authored
      ## Summary
      
      - add a manually dispatchable workflow; the hourly schedule is left
      commented until initial production verification
      - keep the workflow YAML small and place delivery in
      `.github/scripts/next-maintainer-auto-close.js` for normal code review
      - use a short-lived exact-audience GitHub Actions OIDC token with no
      long-lived secret
      - trust the authenticated queue contract instead of reimplementing its
      Zod validation in the workflow
      - post the verifier-authored comment and close with GitHub native
      completed, not planned, or duplicate state reasons
      - retain one invisible marker only to prevent duplicate public comments
      across retries
      
      If an issue is open with the marker, the workflow leaves it open. This
      intentionally lets a human reopen win and avoids timeline
      reconstruction.
      
      ## Permissions
      
      The job grants only `contents: read`, `id-token: write`, and `issues:
      write`; every other permission remains none. Both GitHub actions are
      pinned to full commit SHAs. Checkout is sparse to the one trusted
      JavaScript file and has credential persistence disabled.
      
      ## Verification
      
      - mocked delivery harness passes ten scenarios: empty queue, completed,
      not planned, duplicate, pull-request rejection, already-closed recovery,
      independent close, open marker, transferred issue, and transient failure
      - `node --check`, Prettier, and ESLint pass for the extracted
      implementation
      - Vercel Agent Review, Vercel Security Review, Socket Security, workflow
      change detection, and documentation validation pass
      - after merge, dispatch the registered workflow on `canary` and add the
      production run link here before enabling the hourly schedule
      
      ## Dependency
      
      This is the narrow GitHub write-side companion to
      vercel-labs/next-maintainer-agent#541, which is deployed.
      vercel-labs/next-maintainer-agent#546 further reduces the queue DTO and
      changes the delivery limit to 25 first claims per rolling week; this
      workflow is compatible with both DTO versions.
      0eb4d7d5
    • Jimmy Miller's avatar
      perf(turbopack): skip ignored files during server tracing (#97475) · 8b9cdc5e
      Jimmy Miller authored
      So I was playing around with profiling some very simple next apps when I
      noticed this. Basically, because of how things were set up we were
      spending a good chunk of our build time analyzing files we were going to
      reject. I went around and around trying different combinations to make
      sure we ignore those files (and only the files we should ignore) to
      speed up build times. Since it is a constant impact, mostly on small
      projects, but on some, it can make a big difference. I had some
      adversarial rounds with agents to see if they can break the config in
      the ways the old comments hints at why we didn't do that. And this final
      round finally couldn't get it to break.
      
      For a v0-generated Hello World app, compile time is 28.0% faster
      (+/-1.7%) and a full clean build is 15.9% faster (+/- 1.2%).
      
      ---------
      Co-authored-by: 's avatarNiklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
      8b9cdc5e