- 22 Sep, 2026 5 commits
-
-
next-js-bot[bot] authored
-
Tobias Koppers authored
### What? Adds support for `false` as a value in `experimental.turbopack.resolveAlias`, which resolves the aliased module to an empty stub — matching webpack's long-standing behavior. ```js // next.config.js module.exports = { experimental: { turbopack: { resolveAlias: { 'some-server-only-module': false, }, }, }, } ``` With this alias in place: - `import * as ns from 'some-server-only-module'` → `ns` is `{}` - `import { foo } from 'some-server-only-module'` → `foo` is `undefined` - `import def from 'some-server-only-module'` → `def` is `undefined` - `await import('some-server-only-module')` → resolves to `{}` - `require('some-server-only-module')` → returns `{}` ### Why? Webpack supports `false` as an alias target to stub out modules (e.g. to exclude Node-only packages from client/edge bundles). Turbopack did not, causing migration friction for projects that rely on this pattern. ### How? Threads the `false` sentinel through the full resolution pipeline as a new `Empty` variant: ``` false (config) → SubpathValue::Empty (next-core import map) → ImportMapping::Empty (turbopack-core remap) → ReplacedImportMapping::Empty → ResolveResultItem::Empty → ModuleResolveResultItem::Empty → ReferencedAsset::Empty (ESM static imports) → SinglePatternMapping::Ignored (CJS require / dynamic import) ``` For static ESM imports, `ReferencedAsset::Empty` is kept as a distinct variant so that `binding.rs` can distinguish a namespace import (yields `{}`) from a named/default import (yields `undefined`). For CJS `require()` and dynamic `import()`, `ModuleResolveResultItem::Empty` maps to the existing `SinglePatternMapping::Ignored`, which already generates the correct `{}` / `Promise.resolve({})` stubs — so no new code-generation path was needed there (the redundant `Empty` variant introduced during development was removed in a follow-up cleanup commit). **Files changed:** - `packages/next/src/server/config-shared.ts` — add `false` to `resolveAlias` type - `packages/next/src/server/config-schema.ts` — add `z.literal(false)` to schema - `crates/next-core/src/next_import_map.rs` — map `false` → `SubpathValue::Empty` - `turbopack/crates/turbopack-core/src/resolve/remap.rs` — handle `ImportMapping::Empty` - `turbopack/crates/turbopack-core/src/resolve/mod.rs` — propagate `ModuleResolveResultItem::Empty` - `turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs` — `ReferencedAsset::Empty` - `turbopack/crates/turbopack-ecmascript/src/references/esm/binding.rs` — empty-module binding code-gen - `turbopack/crates/turbopack-ecmascript/src/references/esm/url.rs` — handle Empty in URL refs - `turbopack/crates/turbopack-ecmascript/src/references/async_module.rs` — skip Empty in async module analysis - `turbopack/crates/turbopack-ecmascript/src/references/pattern_mapping.rs` — map Empty → Ignored **Tests:** `test/e2e/turbopack-resolve-alias-false/` covers all five import styles (namespace, named, default, dynamic, CJS). --------- Co-authored-by:vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Jiwon Choi authored
> [!TIP] > Recommended to review commit by commit. ### Why? Support `canary` releases for agentic upgrade so the workflow is available for the dogfooders. Startup reminders also need to check target eligibility before offering an upgrade that the configured policy cannot perform. ### How? Enable latest and Future upgrades on the canary channel while keeping stable installations on stable releases. Security upgrades and advisory checks remain stable-only; canary version ordering is not used to infer security fixes. Share policy-aware advisory and target assessment between startup reminders and explicit upgrades, retaining security warnings when no eligible target is available and offering bare `--ai` only when the configured policy can proceed. Explicit stable `latest` upgrades also check target advisories, after treating strictly older targets as a no-op; equal affected targets remain blocked. Canary latest and Future upgrades skip advisory assessment. Version reminders keep their major/minor threshold, and Future Defaults retain their full-version availability checks. Assessment caching is left as a TODO. The agentic upgrade guide remains a bundled, agent-consumed workflow marked `version: draft`; public-facing documentation will be handled separately.
-
Tobias Koppers authored
### What? Preserve write failures from streaming SST construction instead of replacing them with debug-only writer lifecycle assertions. This adds explicit cancellation, immediate best-effort cleanup of incomplete SSTs, and focused coverage for failed writes and finalization. ### Why? `std::thread::panicking()` is false while an error is propagated through `Result`. On disk-full and similar failures, writers and their owning collectors are therefore dropped before a caller begins panic unwinding, allowing lifecycle assertions to obscure the original I/O error. Leaving partial files until startup recovery also delays reclaiming scarce disk space. ### How? `StreamingSstWriter::cancel()` consumes an incomplete writer, discards buffered bytes without flushing or finalizing, closes the raw handle, and best-effort removes the partial SST. Failed close attempts and unfinished Drop paths use the same cleanup, while deletion failures are ignored so they cannot replace the root error; existing startup recovery remains the fallback. Writer-owning scopes preserve the original error, explicitly cancel their writers, and then return that error. The compaction merge scope cancels both collectors on every error exit so a sibling collector cannot mask the failure. Successful close marks the finalized SST for preservation, and healthy writers still have to call `close()` or `cancel()` to satisfy the debug lifecycle invariant. The regression tests substitute an unbuffered read-only output handle to force deterministic add and close failures without requiring disk pressure. ### Verification - `cargo test -p turbo-persistence` (114 passed) - `cargo check --release -p turbo-persistence` - `cargo fmt --package turbo-persistence -- --check` <!-- NEXT_JS_LLM --> <!-- fleet da0c4e98-b86a-4c93-a519-8a63147e3f5c --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Tobias Koppers authored
### What? Exclude `valued_tombstone_survives_partial_compaction` from Miri test builds while keeping the test enabled for normal Rust test runs. ### Why? The test takes about 16 minutes under Miri and is the sole long-tail test after the rest of the suite finishes. Since nextest runs tests concurrently, this one outlier determines most of the job's wall-clock time. The next-slowest tests finish around 400 seconds, so excluding this case should reduce the Miri job by roughly nine minutes without removing the remaining tombstone-compaction coverage. ### How? Gate only this test with `cfg(not(miri))` and document its measured CI runtime next to the gate. The test body and its native behavior remain unchanged. Verification: - Focused native test passes. - The test is absent from the no-default-features Miri test inventory. - Rust formatting and the no-default-features persistence check pass. <!-- fleet fb42942f-173a-484c-b4de-4e18354834c6 --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by:
Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
-
- 21 Sep, 2026 12 commits
-
-
Aurora Scharff authored
## Summary - review queued feedback immediately before the final response, after requested work and tool calls are complete - run the feedback command only when candidates exist, preserve them when reporting is unavailable, and clear them after each qualifying review form is opened or returned as a fallback URL - add an internal `--dry-run` mode that returns the bundled preview protocol without opening forms or clearing the queue - align the managed instructions, reporting protocol, evals, tests, AI agents guide, and API reference ## Verification - `pnpm --filter=next types` - focused `agent-feedback-instructions` unit tests - `node packages/next/dist/bin/next internal agent-feedback-instructions --dry-run` - targeted Prettier, ESLint, and language checks <!-- NEXT_JS_LLM -->
-
Jiwon Choi authored
### Why? `next@canary` can reuse a cached `canary.33` even after `canary.35` is published, causing `next upgrade --ai` to run outdated upgrade logic. ### How? Resolve the latest official canary from public npm, then reuse the running CLI if it matches or launch and verify that exact version. Keep pnpm installation errors visible so failed launches are diagnosable. The lookup does not use package-manager registry, proxy, or CA settings: public npm must be reachable, and installation can fail if a configured mirror lacks the selected version. <!-- NEXT_JS_LLM -->
-
Jamiboy Mohammad authored
## Summary Move whole development-only suites from `test/e2e` to `test/development`: instant-validation-causes (including its partial-prefetching variant), webpack-loader-errors, use-cache-deadlock-probe, and next-image-https. Update the corresponding test manifests and remove redundant mode checks. Existing disabled coverage remains disabled. The HTTPS image test continues to use its shared e2e fixture. Mixed-suite extractions are reviewed separately in the next PR in the stack. ## Verification - Formatting, ESLint, and whitespace checks passed. - Verified that the two-PR stack's final tree is identical to the previously published combined change. - Runtime tests were not rerun locally for this history-only split; CI runs on both layers. <!-- NEXT_JS_LLM -->
-
Jiwon Choi authored
### Why? The codemod incorrectly adds `instant = false` to helper files because its matcher matches `layout.ts` within `custom-layout.ts` and `page.tsx` within `homepage.tsx`. ### How? Require filenames to start with `page.`, `layout.`, or `default.`, while preserving compound extensions. The codemod does not consult `pageExtensions`, so files such as `page.test.tsx` remain eligible. <!-- NEXT_JS_LLM -->
-
Jamiboy Mohammad authored
## Summary Migrate the shared cache-components error tests and two additional legacy deployment exclusions from `skipDeployment`/`skipped` to test gates, so these callers can land on canary before the API is removed. Place the cache-error gate on the existing named `describe` boundary in each of the 12 `.test.ts` entry files. Jest transforms gate pragmas in test files; a gate in the shared utility would be inert. The helper continues registering the same tests inside those entry-level suites, preserving their names and snapshots. These tests inspect local prerender builds and cannot run against a deployment. The other two callers cover segment-cache fixture mutation and production output-file tracing. This is a standalone preparatory migration, not the removal of the legacy API itself. ## Verification - Rebased onto canary at `ccef3db5`; the stable patch ID matches the original migration exactly. - On the rebased tree, all 77 gate infrastructure unit tests passed. - Deploy-mode Jest collection of all 12 cache-error entry files: 236 skipped, zero executed, and no deployment started. - Prettier, ESLint, and diff whitespace checks passed. - Full bootstrap attempted but blocked by missing package-level dependencies (`microbundle`) in the temporary worktree; no full dev/start integration run is claimed. <!-- NEXT_JS_LLM -->
-
Josh Story authored
## Summary - Narrow build-time generator names to a literal type that can be extended as new generators are added. - Split the combined revalidation diagnostic into render, cached-function, and build-time-generator errors so each failure reports only its actual context and never needs a fallback generator name. - Cover all three contexts in the existing development and production test suites. Follow-up to the review feedback on #98891. ## Verification - `HEADLESS=true pnpm test-dev-webpack test/e2e/app-dir/revalidatetag-rsc/revalidatetag-rsc.test.ts` (3 tests) - `HEADLESS=true pnpm test-start-webpack test/e2e/app-dir/revalidatetag-rsc/revalidatetag-rsc.test.ts` (3 tests) - Production Webpack `generate-static-params-errors` suite (6 tests) - `pnpm --filter=next types` <!-- NEXT_JS_LLM -->
-
Josh Story authored
## Summary This enables strict route matching by default. App Router URLs that cannot construct a complete route tree are rejected, unreachable pages are reported, and incomplete catch-all matchers are pruned. If strict route matching finds one of these invalid route structures, Next.js warns that the validation implies a bug in the app and points to `deprecated.looseRouteMatching: true` as a temporary escape hatch. The deprecated option only accepts `true`; strict matching remains the normalized internal behavior when the option is absent. For example, this layout cannot render either URL as a complete route because neither named slot has a page or default for the URL matched by its sibling: ```text app/ ├── layout.tsx ├── @left/foo/page.tsx └── @right/bar/page.tsx ``` Previously the app could depend on soft navigation preserving stale slot state even though `/foo` and `/bar` could not be loaded directly. With strict route matching enabled, the build reports the incompatible slots and the two unreachable pages. Adding explicit defaults makes the intended fallback behavior valid again. ## Verification - `pnpm build-all` - `pnpm exec jest packages/next/src/server/config.test.ts --runInBand` - `parallel-routes-pruned-matchers` in production with Turbopack and Webpack - `parallel-routes-leaf-segments` in production with Turbopack - strict diagnostic fixtures in production with Turbopack <!-- NEXT_JS_LLM -->
-
Aurora Scharff authored
## Summary - Distinguish an unreachable agent-feedback rollout gate from an explicitly disabled rollout. - Exit the internal feedback-instructions command with actionable retry guidance so sandboxed agents can request network access instead of silently skipping reports. ## Verification - `pnpm exec jest packages/next/src/cli/internal/agent-feedback-status.test.ts packages/next/src/cli/internal/agent-feedback-instructions.test.ts --runInBand` - `pnpm --filter=next types` - `pnpm --filter=next build` - Verified the built CLI exits 1 with retry guidance without network access and returns the protocol with network access. <!-- NEXT_JS_LLM -->
-
Josh Story authored
## Summary Rename the internal `GenerateStaticParamsStore` work-unit context to `BuildTimeGeneratorStore`, with discriminant `build-time-generator`. Carry the public export name in a required `functionName` field so shared error paths identify the generator that is actually running. This is a behavior-preserving preparatory refactor. `generateStaticParams` remains the only producer. Every consumer retains the same branch, so public-cache support, unavailable request APIs, inherited root parameters, and existing error messages are unchanged. The name describes a build-time generator's execution context rather than one function. For example, another generator that loads configuration through a cached helper should be able to reuse this context without introducing another work-unit variant throughout the framework. Function-specific contexts can be added later if their semantics actually diverge. For example, a generator that calls `headers()` needs an error naming that generator, not an error that always says `generateStaticParams`. The field is set explicitly rather than read from `Function.name`, which may change during bundling. Request APIs, private-cache rejection, revalidation, and rendering invariants use this name. Missing-root-param advice about parent gSP calls remains specific to gSP; other generators report that the value is unavailable in their own scope. This independent prerequisite for #97393 introduces no API or feature flag. The API-specific initializer and its error fixtures live in #97393, so this PR remains independently landable and behavior-preserving for existing gSP users. ## Verification - Existing `generate-static-params-errors`, `app-root-params-getters/generate-static-params`, and `generate-static-params-error` fixtures: all ten production Webpack tests pass, including unchanged error strings and parent root-param behavior. - Existing `use-cache/use-cache.test.ts` static-HTML assertion passes, exercising cached helpers called from gSP in both a page and route handler. - Full bootstrap and TypeScript declaration build pass. <!-- NEXT_JS_LLM -->
-
Josh Story authored
## Summary Use structural React keys during server rendering so an HTML prerender can resume without rewriting React's postponed state when route params become known. Browser keys and router-cache identity are unchanged. For example, `/products/[slug]` previously prerendered layout boundaries with a key containing an opaque slug placeholder. Resuming `/products/shoe` produced a different key, so Next.js substituted `shoe` into the serialized React state before handing it back to React. Both server passes now use `slug|d`. The browser still uses `slug|shoe|d`, preserving template remounts and back/forward state behavior. The server only renders the active entry at each layout-router position, so it does not need parameter values to distinguish cached browser entries. React keys are not embedded in the HTML; hydration derives its concrete keys from the request's route state. - Use segment name/type for server layout keys and structural route paths for the server head key. Server keys always omit search params. The existing browser-module variant mechanism selects the concrete key implementation for browser bundles in both Webpack and Turbopack. - Remove placeholder substitution and the request-params argument from postponed-state parsing. Persist only fallback param names for render staging; React's postponed state no longer needs to be searched or rewritten. - Simplify the remaining opaque fallback map to param name → placeholder. Its dynamic-param type slot is unused after removing interpolation. Parameter wrappers still control suspension; this does not make unknown params available to application code. - Test server and browser keys directly, including catch-all/intercepted segments and search params. Update the action-only resume fixture's single assertion on the resume-metadata format so its three cases reach their behavioral checks for action execution, revalidation, and `notFound()` with names-only metadata. This refactor is independently landable against `canary` and is now the base of the parameter-matching stack: #98944 → #98891 → #98892 → #98893 → #97393. It supersedes #98890. It retains internal opaque placeholders but removes their role in matching React's postponed state. No new integration fixtures are needed. ## Verification Latest cleanup: - 126 focused unit tests and 4 snapshots pass in both default and Cache Components/Webpack configurations. - 34 production Webpack tests pass across `fallback-shells`, `partial-fallback-shell-upgrade`, `action-only-fallback-resume-data-cache`, and `resuming-head-runtime-search-param`; 4 existing tests remain skipped. The three action-only resume cases now reach and pass their behavioral assertions. Earlier commits also passed existing production and dev Webpack coverage for back/forward state, template remounts, base-path params, nested/parallel/intercepted routes, form-state hydration, and standalone/edge output. A reviewer verified this head under Turbopack using a native binary built from the same commit: a broader unit selection passed (144 tests, the focused set above plus the remaining router-reducer suites), the `packages/next` type check was clean, and 33 production e2e tests passed across `fallback-shells`, `partial-fallback-shell-upgrade`, and `action-only-fallback-resume-data-cache`. <!-- NEXT_JS_LLM -->
-
next-js-bot[bot] authored
-
François Martin authored
### Fixing a bug Nothing reads the two fields `hasWarnings` and `warnings` on `TypeCheckResult`. `verifyAndRunTypeScript` has four callers: - `build/type-check.ts` only reads `inputFilesCount`, `totalFilesCount` and `incremental` - `next-test` only reads `version` - `setup-dev-bundler` only reads `version` - `next-typegen` throws the result away `warnings` is also always empty. It looks for diagnostics with the `Warning` category, but I checked, and TypeScript 6.0.2 has no messages in that category. Deprecation messages use `Suggestion` instead. So on every build, we filtered and formatted every diagnostic to build a list that was always empty, and that nobody read. So I'm suggesting removing it instead, as it is clearly not being used. I also checked the GitHub code search across all public repositories and couldn't find anyone using either of them. That aside, it also never really worked correctly, as it would always return `hasWarnings: true` even if `warnings` was empty. No test added since the fields are being removed. Also since this is such a small change I didn't create an issue to link here, I'd be happy to file one if you prefer me to. Thanks for the hard work and taking the time for reviewing this PR!
😊
-
- 19 Sep, 2026 5 commits
-
-
next-js-bot[bot] authored
-
Josh Story authored
## Summary Preserve the restrictions of `dynamicParams = false` in client route prediction, independently of the proposed parameter-matching API. For `/products/[slug]` with only `allowed` generated during the build, learning `/products/allowed` must not imply that `/products/rejected` exists. This remains true when the page never reads `slug`. The transport-tree builder now attaches `PrefetchHint.IsClosedParam` to the affected dynamic node, rather than putting a route-level bit on the response root or copying it to every prefetch node. Live rendering, error trees, and prefetch-hint collection preserve that placement. Legacy `dynamicParams = false` closes the entire parameter tuple. For `/catalog/[lang]/products/[slug]/details`, both `[lang]` and `[slug]` receive the hint; the static segments do not. Shared ancestors refresh their hints even when their UI is reused: navigating between open and closed pages under the same `[slug]` must add or clear the restriction. Client behavior remains conservative: optimistic route prediction declines a tree containing any closed parameter and asks the server to resolve the destination. Existing apps combining `dynamicParams = false` with `experimental.optimisticRouting` therefore lose prediction for those routes. Sending allowed parameter values to the client and predicting valid destinations from that list is future work, not part of this change. This PR is an independent prerequisite extracted from #97393. It does not enable Cache Components, introduce parameter-matching configuration, or change which parameter values are allowed. The later API layer supplies exact closed-parameter names for routes with a closed prefix and an open suffix. ## Verification - The legacy routing/navigation fixture runs with Cache Components disabled. Revised node-placement assertions fail against the old response-root representation. The shared-sibling navigation test also reproduced stale hints before the skipped-ancestor refresh was added. - Initial documents and live client navigations with `prefetch={false}` place the hint on `[slug]`; open routes carry no closure hint. A nested legacy route marks both dynamic parameters, and open/closed sibling navigation updates a reused ancestor. - Five tests pass in development with both Turbopack and Webpack. The three existing prefetch-dependent scenarios retain their production-only gates; all eight tests pass in production with both bundlers. - The seven production scenarios present before adding shared-sibling navigation also passed with optimistic routing disabled in the Webpack axis-A configuration. - Existing config and transport-tree helper unit suites pass (22 tests and one snapshot), and repository TypeScript checks pass. - The eight-test legacy fixture also passes on the integrated API head. An exploratory dev run of the combined routing-404 scenario encountered an intermittent Turbopack `NoFallbackError`/500; a subsequent run returned the expected 404. This PR does not fix that observation or claim dev coverage for that production-only scenario. <!-- NEXT_JS_LLM --> -
Hendrik Liebau authored
PR #98776 moved deployment creation into `start()` and made deploy mode honor `skipStart`. Two suites consequently requested an undefined URL, as reported in https://github.com/vercel/next.js/actions/runs/35407031061. The `use-cache-output-export` suite now skips automatic startup only in local production mode. The `trace-build-file` suite now excludes deploy mode because its trace assertions require local build output.
-
Benjamin Woodruff authored
Full motivation and plan here: https://app.notion.com/p/vercel/Turbopack-pnpm-Global-Virtual-Store-383e06b059c480579403ddfd71cc2d40?source=copy_link The goal is to allow `DiskFileSystem` to traverse outside of it's own root to other configured `DiskFileSystem`s when following symlinks. We may allow traversal in other situations in the future, but this is limited to symlink resolution for now. ## Global Virtual Store The motivation for this is to enable [pnpm's Global Virtual Store feature](https://pnpm.io/global-virtual-store) (and there are other package managers doing this, including nub and bun). We'd expose the ability to manually configure this in `next.config.js`, but we should also auto-configure ourselves for popular package managers (or at least make a best effort to do so, the `PNPM_HOME` semantics can be complicated). The `ignoreIfMissing` option is provided for this situation: We can configure a bunch of roots automatically, and they only actually get set up if they exist, the check for directory existence is cheap. ## NFT changes This requires a couple extensions to the `*.nft.json` file format: https://github.com/vercel/next.js/pull/98469 ## Related Issues - #93556 - https://github.com/pnpm/pnpm/issues/14972
-
Benjamin Woodruff authored
Implements the following extension: ```typescript export interface NftFileList { // File paths relative to the directory containing the `.nft.json` file, or // the current root (if inside of `NftAdditionalRoot`). // // When using webpack, these paths may exist outside of the tracing root. The // [`@vercel/next` package ignores these paths][vc-next]. // // When using Turbopack, these paths are all guaranteed to exist within the // `turbopack.root` specified or inferred from the `next.config.js` file. // // [vc-next]: https://github.com/vercel/vercel/blob/%40vercel/next%404.20.5/packages/next/src/server-build.ts#L1022-L1026 files: string[] // Turbopack extension: A parallel array to `files` (same indices and length) // with file content hashes. For symlinks, the hash of the path of the target // is stored. fileHashes?: string[] // Turbopack extension: Explicit symlink mapping information. // // If included, it's safe to assume that if a file is not in `symlinks` that // it is not a symlink. If this is an empty array, there are no symlinks. // // If omitted, the processor of the nft file must call `read_link` on every // file to determine if it is a symlink and determine the target path. // // This field is always included if `NftJson` includes `additionalRoots`, and // it is always included on `NftAdditionalRoot`. symlinks?: NftSymlink[] } export interface NftJson extends NftFileList { version: 1 // Turbopack extension: A hash of the entrypoint that refers to these traced // files. This hash only depends on the content of the entrypoint file, and // not all of its traced dependencies. entryHash?: string // Turbopack extension: Paths stored with different base paths, typically // outside of the tracing root. additionalRoots?: NftAdditionalRoot[] } // Turbopack extension: A collection of paths stored with a different base path. export interface NftAdditionalRoot extends NftFileList { // Stable unique identifier provided in the `next.config.js`. This can be used // to generate the output path where these files are copied to (e.g. // `.additionalRoots/$[name}`). // // This is guaranteed to use a character set that is valid on most // filesystems, and the identifiers are guaranteed to not have overlaps on // case-insensitive filesystems. name: string // A source path on the build machine that the paths in `files` are relative // to. The final build output directory should not depend on this path. absolutePath: string // Always specified on NftAdditionalRoot. symlinks: NftSymlink[] } // Turbopack extension: Information on a symlink, including which additional // root it maps to. Symlinks that do not cross root boundaries (the common case) // omit the index into `additionalRoots`. // // It is often complicated to transform raw symlink targets to root-relative // paths, and including this information here ensures that the NFT reader gets // the same result that Turbopack's tracing system expects. // // Because the link target type is unspecified, on Windows the reader needs to // call `stat` to determine if a link target is a directory or file. export type NftSymlink = | [ // Index of `files` that refers to a symlink. number, // The target path of the link. In `NftJson`, this path is relative to the // directory containing the `.nft.json` file. In `NftAdditionalRoot`, this // is relative to the current root. string, ] | [ // Index of `files` that refers to a symlink. number, // The target path of the link relative to the specified root. string, // An index into `additionalRoots`, -1 if the target path is relative to // the `.nft.json` file's directory, // // If the symlink target is relative to the same root as the symlink // itself (the "current root"), this field is omitted. number, ] ``` Nothing currently populates `additionalRoots`. https://github.com/vercel/next.js/pull/98003 will do it.
-
- 18 Sep, 2026 17 commits
-
-
next-js-bot[bot] authored
-
Tobias Koppers authored
### What? Ensure a GC-resurrected persistent task is persisted again as a new task. This is the final layer in stack #98709 and depends on the restore-waiter lifetime fix in #98728. ### Why? GC soft-deletes a disconnected task, then the following snapshot persists a tombstone that removes its durable task record and task-type lookup entry. Normal operations resume after the snapshot's logical state is frozen, so a concurrent connection can still find the resident soft-deleted task and resurrect it before post-snapshot eviction removes the in-memory entry. Resurrection already cleared `deleted`, marked the task dirty, and scheduled recomputation. It did not, however, mark the task as newly publishable. If the tombstone had already committed, later snapshots could persist recomputed data without re-establishing the complete persistent identity of the resurrected task. Once in-memory cache state was evicted, future lookups could no longer recover that otherwise-live task by type. A resident deleted task is guaranteed to retain its type: GC restores all categories before marking it deleted, and post-snapshot eviction handles deleted tasks by removing the whole entry rather than partially dropping the type. ### How? When the connect handshake wins the resurrection race, mark the task as `new_task` again and mark its Data category modified. The next snapshot therefore persists it using the normal new-task path, including recreating its task-type lookup entry and the Data record used to verify that lookup. The task remains dirty so its cells and graph edges are rebuilt through the existing recomputation path. The update is unconditional for a resident deleted task; a missing type remains an invariant violation rather than being silently skipped. ### Verification - Top-of-stack stress: 0 failures across 1,200 runs using 8 parallel workers - Sequential stress: 0 failures across 150 runs - `cargo test -p turbo-tasks-backend --lib` (102 passed) - `cargo test -p turbo-tasks-backend --test eviction --test gc_resurrection --test gc_collection --test gc_interrupt --test gc_stress` (19 passed) - `cargo fmt -- --check` - `cargo clippy -p turbo-tasks-backend --tests -- -D warnings` Depends on #98728. <!-- NEXT_JS_LLM --> <!-- fleet 6aa6acec-6286-4b03-86f4-13f4c7e2b2fa --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
-
Benjamin Woodruff authored
https://github.com/vercel/next.js/pull/98440 unintentionally caused the rspack `Cargo.lock` to become outdated because it added a `smallvec` dependency to `turbo-unix-path`, which gets used by `next-taskless`. We only really need `smallvec`'s `serde` and `bincode_impl` features when used with turbo-tasks, so move the feature declaration there.
-
Tobias Koppers authored
### What? Keep a task alive across the restore-waiter handoff: from the moment a caller observes another thread restoring a category until that caller acquires the restored task for use. This is the first open layer in stack #98709. The construction and restore-owner races have already landed in `canary` through #98688 and #98700. ### Why? The `restoring` bits elect exactly one thread to perform backing-storage I/O. A waiting caller observes that ownership under the task lock, drops the lock, and then holds only a `TaskId` while waiting for notification. That temporary in-session reference is not represented by a parent or aggregation edge, so GC may otherwise collect the task after the restorer clears its bit but before the waiter acquires a guard. Eviction is different: it is safe for eviction to clear the completed restore in this window as long as the waiter does not mistake that state for an I/O failure. The waiter can claim the now-unowned category and restore it again. Batch preparation has the same task-id-outside-the-graph interval between classification and callback. Pair access needs both task IDs kept alive until both guards can be acquired together. ### How? Each waiting caller increments the existing `transient_ref_count` before dropping the task lock and decrements exactly one ref under the guard at its actual use boundary. This uses the GC-root mechanism and invariant checks that already protect construction, transient-parent, and detached-handle references. The transient ref does not block value eviction. If a waiter observes a category that is neither restored nor currently restoring, it keeps its GC pin, claims the category, and performs another restore. A replacement restorer retains its acquired guard through notification and returns that same still-pinned guard to the caller. Successful pin release belongs entirely to the caller: - single-task access releases after receiving the restored guard; - pair access releases after acquiring both guards together; - batch preparation releases immediately before passing the guard to its callback. The helper decrements the ref itself only on `Err`, where no guard is returned. The already-restored fast path remains and avoids listener registration. This removes the dedicated handoff field and eviction blocker. It also keeps `gc_maybe_collectible()` and `gc_debug_assert_root_held_by_transient_pin()` aligned on the same existing transient-ref predicate. ### Verification - Latest `origin/canary` (`389f164d`) in a detached worktree - `cargo test -p turbo-tasks-backend --lib` (102 passed) - `cargo test -p turbo-tasks-backend --test eviction --test gc_resurrection --test gc_collection --test gc_interrupt --test gc_stress` (19 passed) - Eviction-permitting stress: 0 failures across 1,200 runs using 8 parallel workers - Sequential stress: 0 failures across 150 runs - `cargo fmt -- --check` - `cargo clippy -p turbo-tasks-backend --tests -- -D warnings` Followed by #98729. <!-- NEXT_JS_LLM --> <!-- fleet 6aa6acec-6286-4b03-86f4-13f4c7e2b2fa --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Josh Story authored
## Summary Make deploy mode follow the existing setup/start lifecycle: skipStart prepares the fixture without deploying, and next.start() performs the deployment. Failed starts retain CLI and build logs before rejecting, so tests can assert expected build failures in their own bodies. Default automatic startup still fails its setup hook on an uncaught deployment error. Remove the expectDeploymentFailure option. Refactor app-invalid-revalidate into fixed fixtures and use the same start/error assertions locally and on Vercel, without a deployment exclusion. ## Verification - All four invalid-revalidate cases passed against real Vercel preview builds with Turbopack. Each test caught the rejection from `next.start()` and asserted the expected diagnostic in `next.cliOutput`; no skipped tests. - All four cases passed locally in dev and start modes with both Turbopack and webpack. - Seventeen lifecycle unit tests passed, covering the real `nextTestSetup` hooks, deferred/default startup, failed-build logs, retries, repeated starts, custom scripts, existing deployments, and cleanup. - `pnpm test-deploy-turbo test/e2e/test-utils-tests/basic/basic.test.ts`: the default automatic deployment reached READY and loaded its build/deployment IDs, but the HTTP assertion failed because the temporary project's protection redirected to Vercel SSO. Project protection settings were left unchanged. The suite's separate, existing Cache Components manifest exclusion is unchanged. <!-- NEXT_JS_LLM -->
-
Will Binns-Smith authored
## Summary Rename `NEXT_DEV_WAIT_FOR_TURBOPACK_SHUTDOWN` to `__NEXT_DEV_WAIT_FOR_TURBOPACK_SHUTDOWN` to mark the environment variable as internal and subject to change. ## Verification - `pnpm --filter=next types` - `pnpm prettier --with-node-modules --ignore-path .prettierignore --check packages/next/src/cli/next-dev.ts packages/next/src/server/dev/hot-reloader-turbopack.ts test/e2e/filesystem-cache/warm-restart-task-stats.test.ts` - `npx eslint --config eslint.config.mjs packages/next/src/cli/next-dev.ts packages/next/src/server/dev/hot-reloader-turbopack.ts test/e2e/filesystem-cache/warm-restart-task-stats.test.ts` - Focused test attempted: `pnpm test-dev-turbo test/e2e/filesystem-cache/warm-restart-task-stats.test.ts` (failed because the fixture did not emit `.next/dev/server/pages/_app/build-manifest.json`, causing the page request to return 500 before the assertion) <!-- NEXT_JS_LLM -->
-
Janka Uryga authored
- ISR prerenders can take a moment to propagate in `deploy`, longer than in `start`, so do a retry loop that waits for the fallback to go away before running tests that need it - ISR fallbacks are only upgraded when using adapters, skip the tests that care about those if using legacy deploy bc they'll fail otherwise
-
Jimmy Miller authored
I was noticing the generated file change every time I ran `pnpm swc-build-native`. This comment was added [here](https://github.com/vercel/next.js/pull/98378/changes#diff-0db38a2a3ab56ce5ce08014e3f096a6043c5fedd54a4048d231de4cbaa4ed6f1R512) in the generated file, but not in the source
-
Aurora Scharff authored
### What? Adds eval coverage for the experimental agent feedback workflow: - Routine debugging should not produce a report - Qualifying friction should produce an anonymized structured report - Distinct issues should produce separate review forms Also adds repeat-run and variant controls so trigger frequency can be measured across multiple runs. Local-Skill and agent-feedback/privacy evals are marked `publish: false`, with scoped `evals/AGENTS.md` instructions preventing their fixtures, transcripts, or scores from being exported to the public benchmark. ### Why? We need to measure trigger precision, anonymization, issue splitting, and duplicate prevention before expanding the experiment. ### How? Depends on #98582. The `agent-feedback` treatment uses the managed block and bundled reporting protocol from the parent PR. Only the remote rollout gate is forced on inside the eval sandbox so runs are deterministic. | Eval | Baseline | Agent rules | Agent feedback | 10-run treatment | | --- | --- | --- | --- | --- | | Routine debugging | Pending | Pending | 1/1 passed | Pending | | Anonymization | Pending | Pending | 2/2 reporting checks passed | Pending | | Distinct issues | Pending | Pending | 1/1 passed | Pending | The first attempted run did not reach the agent because the local sandbox was not linked to a Vercel project. It is infrastructure setup and is not included in the results above. The first distinct-issues run produced the expected two separate payloads. Its scorer rejected them because the parser did not allow the existing `token` query parameter and the browser criterion required an open attempt even when the agent environment exposed no browser capability. After correcting those assertions and clarifying the stopping-point wording, the scored rerun passed. Both anonymization treatments produced one valid payload with none of the seeded customer, project, route, local-path, internal-URL, or secret values. The corrected rerun also selected `misleading-error` and passed every reporting assertion. An inherited `.next`-preservation assertion was removed from this fixture because it measures `next-dev-loop` behavior, not agent-feedback anonymization; Skill queue coordination belongs in a separate focused eval.
-
Aurora Scharff authored
## Summary Adds an off-by-default `experimental.agentFeedback` workflow for collecting Next.js friction without interrupting the user’s task. - `next dev` writes a small managed block to the project agent-instructions file. - Agent entry points, including `next-dev-loop`, queue possible issues instead of opening duplicate forms. - At the final stopping point, an internal command checks the remote gate and returns the reporting protocol bundled with that Next.js version. The agent attempts to anonymize each qualifying issue and opens a separate review form once. If the browser does not open, it prints the URL for the user without troubleshooting the failure. - Report links no longer contain a public page token. Nothing is sent until the user submits the form, which remains rate-limited and uses a server-only ingest credential. - Disabling `agentFeedback` or `agentRules` removes only its managed block on the next `next dev`. Empty generated agent files are cleaned up; user-authored content is preserved. - Adds API references for both options and updates the AI agents guide. Bundling the protocol keeps the managed block small and allows the report format to evolve with each Next.js version. The receiving form is implemented in [vercel/front#85739](https://github.com/vercel/front/pull/85739) and should deploy before this workflow is enabled. ## Verification - `NEXT_SKIP_ISOLATE=1 pnpm test-dev-turbo test/development/app-dir/agent-rules-auto-generate/agent-rules-auto-generate.test.ts` - `pnpm jest packages/next/src/server/lib/generate-agent-files.test.ts packages/next/src/cli/internal` - `npx eslint --config eslint.config.mjs packages/create-next-app/helpers/generate-agent-files.ts packages/next/src/server/config-shared.ts packages/next/src/server/lib/generate-agent-files.ts test/development/app-dir/agent-rules-auto-generate/agent-rules-auto-generate.test.ts` <!-- NEXT_JS_LLM -->
-
Jimmy Miller authored
With turbopackLazyDynamicImports enabled, I was finding that we were emitted empty assets that slowed down warm builds. This prevents these unnecessary output assets to remove overhead.
-
Jimmy Miller authored
next/dynamic assumes a eager semantic for css gathering, we are making sure that holds even when lazy dynamic imports are enabled
-
Jiwon Choi authored
So the framework can nudge agent/human in the future
-
Eddy (Frontend Engineer) authored
example(cache-handler-redis): fix connection leak, hangs on a down Redis, and cross-page tag invalidation (#98716) Three runtime problems in `examples/cache-handler-redis`. ### 1. One new Redis connection per request, never closed Next.js constructs the singular `cacheHandler` class once per request (`new CurCacheHandler(...)` in `IncrementalCache`, which `route-module.ts` creates per request). The example's constructor calls `createClient()` + `connect()`, so every request opens a connection that is never closed. ``` $ redis-cli client list | wc -l # before 102 $ for i in $(seq 1 10); do curl -s -o /dev/null localhost:3000/cet; done $ redis-cli client list | wc -l 132 # +3 per request ``` With Redis' default `maxclients 10000`, a single instance runs out after a few thousand requests. ### 2. Requests hang while Redis is unavailable The README says the handlers "degrade gracefully when Redis is unavailable, so the app still builds and runs, just without a shared cache". At runtime they don't: with Redis stopped, every request on every instance blocks until Redis comes back. ``` $ docker stop cache-handler-redis $ curl -s -o /dev/null -m 60 -w "%{http_code} %{time_total}s\n" localhost:3000/cet 000 60.007305s # (uncapped: 188s, returned the moment Redis was started again) ``` Same when the app is started while Redis is down. Cause: node-redis keeps retrying in the background and `client.connect()` does not settle until a connection succeeds. Isolated: ```js const c = createClient({ url: "redis://localhost:6379" }); c.on("error", () => {}); await Promise.race([c.connect(), new Promise(r => setTimeout(() => r("pending"), 15000))]); // -> "pending" after 15s, isOpen=true isReady=false (redis@6.2.1) ``` Because each request built a new handler, each request awaited a fresh, never-settling `connect()` in `getClient()`. `remote-cache-handler.js` has one module-level client, but its `getClient()` awaits the same promise, so it hangs the same way if the app starts while Redis is down. ### 3. `updateTag` never reaches other pages' remote entries The remote handler's `get` never checks the entry's own tags. Next.js only passes soft tags to `getExpiration`, and the `"use cache"` wrapper only knows about tags revalidated in the current request, so `updateTag("time-data")` from `/cet` left the `/gmt` entry stale on every instance, including the one that ran it, until it expired (`cacheLife` `expire: 3600`). The [`cacheHandlers` docs](https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheHandlers#get) say `get` should report an entry whose tag was invalidated as missing or stale. ### Fix - Hoist the client in `cache-handler.js` to module scope (the pattern `remote-cache-handler.js` already uses). - `getClient()` awaits the connect promise raced against a 1s `unref()`'d timer (suggested in review), then returns the client when `isReady` and `null` otherwise. Requests during startup still wait for the connection, and a down Redis costs one bounded wait instead of blocking every request. The client keeps retrying and `isReady` flips back on its own. - `disableOfflineQueue: true`, so a command issued while the connection is down rejects immediately (`ClientOfflineError`) instead of being queued for the 5s command timeout. - Entry `get` / `set` catch the Redis call only and degrade to a miss. - Remote `get` compares the entry's tags against their revalidation timestamps (one `MGET`) and misses when any is newer, the same comparison as the built-in handler. `getExpiration` returns `Date.now()` when Redis can't answer, so the entry is discarded rather than served. - `revalidateTag` / `updateTags` throw when Redis isn't ready, so an invalidation that never reached Redis surfaces as an error instead of a success whose entries come back once Redis does. ### After Two `next start` instances on one Redis, same script on `next@16.3.5` and `16.4.0-canary.35` (identical results), canary's handlers vs this PR: | scenario | before | after | | --- | --- | --- | | `updateTag` from `/cet`, read `/gmt` on both instances | stale | refreshed | | `revalidateTag("time-data", "max")` | neither page refreshed | both refreshed | | tag lookup fails | 500 | 200, regenerated | | request while Redis is stopped | no response | 200, uncached | | `updateTag` while Redis is stopped | no response | 500, error logged | | app started without Redis | no response | first ISR read waits ≤1.1s once | | Redis connections, 200 requests | 173 → 773 | 7 → 7 | | `/cet` under load (autocannon, 10 connections × 10s, `16.3.5`) | 332 req/s, hits Redis `maxclients` | 1,106 req/s median, p99 20ms, 3 connections | | 10 readers during 20 `updateTag`s: reads served a value from before a completed invalidation | 3,089 of 3,089 | 0 of 33,899 | | Redis down ~4s under load | timeouts, caching doesn't come back | 0 errors, caching resumes | The tag check costs one Redis round trip per remote hit (−9 to −13% on a route that only reads one remote entry). Handler-level cases, full tables and the benchmark breakdown are in [this comment](https://github.com/vercel/next.js/pull/98716#issuecomment-5724918096). -
Jiwon Choi authored
If upgrade handles the Node version check, upgrade from Next version that allowed Node v18 -> Next version that require Node v20 can fail the upgrade. Next handles compatible Node version so proceed upgrade and let agent handle it afterwards.
-
Niklas Mischkulnig authored
### What? Adds a CI job that runs selected Rust unit tests under [Miri](https://github.com/rust-lang/miri) to detect undefined behavior in unsafe code. The job currently covers the low-level crates that are compatible with Miri: - `turbo-persistence` - `turbo-rcstr` - `turbo-tasks-malloc` It also makes those crates Miri-compatible by: - using provenance-free tagged-pointer operations in `turbo-rcstr`; - disabling mimalloc and native compression under Miri; - making mmap support a default-enabled Cargo feature that is disabled for Miri and wasm; - running persistence through file I/O when mmap is disabled; - skipping only tests measured to exceed the Miri time budget; - removing leaked test arenas from the analyzer predicate tests. ### Why? Miri can detect invalid memory access and other undefined behavior that normal Rust tests may not expose. Running it in CI gives low-level unsafe code an additional correctness check. The job uses an explicit package allowlist because Turbo Tasks builds its generated registry from linker sections, and Miri does not support the linker-defined section symbols required by that registry. ### How? - Installs the `miri` Rust component in CI and the development container. - Adds a dedicated `test-cargo-unit-miri` task and reusable workflow configuration. - Makes `memmap2` optional behind the default `mmap` feature and disables that feature in Miri CI and the wasm dependency graph. - Uses structural `cfg(miri)` branches for allocator and compression paths Miri cannot execute. - Re-enables three persistence compaction tests after measuring them successfully under Miri. - Keeps normal native behavior unchanged and documents measured Miri exclusions at the affected tests. Verification included focused normal and Miri tests for persistence, rcstr, allocation accounting, compression, and the refactored leak-free predicate cases. <!-- NEXT_JS_LLM --> <!-- fleet fb42942f-173a-484c-b4de-4e18354834c6 --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Janka Uryga authored
- in `dev`, wait for validation to run before asserting on a redbox being open (encapsulated in `getInstantInsight`), which should reduce flakiness in webpack - in `start`, check if the build actually succeeded before running tests. these builds seem to occasionally fail, but the cause is currently unknown
-
- 17 Sep, 2026 1 commit
-
-
next-js-bot[bot] authored
-