- 26 Sep, 2026 4 commits
-
-
next-js-bot[bot] authored
-
Luke Sandberg authored
## Summary A dynamically imported local-only ESM module could load through a facade while static named imports resolved to its locals module. For shared singletons, that meant two runtime identities. This backs off the facade split introduced for export mangling in #97770, addressing the remote-components regression reproduced in #99279. Modules with actual re-exports still split as before, and unsplit modules remain eligible for export-name mangling when their names can be changed safely. Escaping namespaces keep their original export names. Focused execution coverage checks that mixed dynamic/static imports register a single module identity; the affected namespace and snapshot expectations are updated. ## Verification - `cargo test -p turbopack-tests --test execution` — 311 passed. - `cargo test -p turbopack-tests --test snapshot` — 132 passed. - Turbopack ECMAScript unit suite — 590 passed. - `pnpm build-all`, `cargo fmt --all -- --check`, Prettier and lint-staged checks passed. - Both #99279 production Turbopack fixtures passed with shared-singleton assertions in a disposable checkout; those unmerged fixtures are not included here. <!-- NEXT_JS_LLM --> <!-- fleet faf1202d-c919-4f7d-bb74-d3fe954bbc57 --> --------- 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>
-
Janka Uryga authored
we weren't using this flag in any deploy tests so this was fine, but i'm about to
-
Benjamin Woodruff authored
Fixes https://github.com/vercel/next.js/issues/99157 Normally, we only allow crossing roots at symlink boundaries, but the webpack loader could cross roots by following a symlink, and we should allow that.
-
- 25 Sep, 2026 36 commits
-
-
next-js-bot[bot] authored
-
Josh Story authored
This PR was authored by codex but I'll share the motivation here in my own words. In an effort to improve the architectural underpinnings of Next.js we need to move away from a request/response dominated interface for rendering in Next.js. The legacy of this style is code that in some cases targets a fake Request or Response object even in cases where we are prerendering and no such objects actually exist. This PR adds a new concept of RouteMatch which seems overkill for only containing the resolvedPathname however we will be migrating more properties out of catchall context such as renderOpts and other request local context into more semantically meaningful packaging. ## Summary Introduce a required `RouteMatch` containing the route-prepared `resolvedPathname` and pass it explicitly through the Node, Edge, direct server, and static export app-page render entrypoints. The type is owned by the app-page route-module handler boundary rather than app-render. `resolvedPathname` is no longer written to or read from request metadata, preventing downstream code with request access from depending on that side channel while preserving the existing delimiter-safe pathname representation. ## Verification - `pnpm prettier --with-node-modules --ignore-path .prettierignore --write <changed files>` - `npx eslint --config eslint.config.mjs --fix <changed files>` - `git diff --cached --check` - Source grep confirming there are no `resolvedPathname` request-metadata reads, writes, or fields - Could not complete: `pnpm --filter=next types` (this fresh worktree lacks per-package dependencies and compiled declarations; the check failed broadly on unrelated missing modules) <!-- NEXT_JS_LLM -->
-
Joseph authored
- The `sizes` section didn't explain what happens to `fill` images without `sizes`. Only images with a `width` get the limited `1x`/`2x` `srcset` - `fill` images get one built from `deviceSizes`. - Updated `deviceSizes` to match: it's also used for `fill` images without `sizes`. - "Forever" isn't an accurate description of static image import caching. The built-in image optimizer serves these with `public, max-age=315360000, immutable`, which is 10 years ([source](https://github.com/vercel/next.js/blob/aea417ab0c490ec3e07112ed48ba20236fdfad18/packages/next/src/server/image-optimizer.ts#L305-L309), [header](https://github.com/vercel/next.js/blob/aea417ab0c490ec3e07112ed48ba20236fdfad18/packages/next/src/server/image-optimizer.ts#L831)). - Changed to "long-lived `immutable`" in the image and `legacy` image references.
-
Jamiboy Mohammad authored
## Summary Both suites assert on build output — one that `next build` warns about TypeScript 4.0.6, the other that it stays quiet on a current version. Deploy captures build output, so there is nothing here a deployment cannot observe. They were excluded by `skipDeployment` plus an `if (isNextDeploy || isNextDev)` return that reads as caution rather than a finding: no incompatibility is recorded anywhere, and neither suite touches the filesystem or the local CLI. ```diff - const { next, isNextDeploy, isNextDev, skipped } = nextTestSetup({ + const { next, isNextDev } = nextTestSetup({ files: __dirname, skipStart: true, - skipDeployment: true, - if (skipped) { return } - if (isNextDeploy || isNextDev) { + if (isNextDev) { it('should skip', () => {}) return } ``` The `isNextDev` half of the guard is the part that holds — the warning is emitted during a build, and there is no build in dev. ## The 240s timeout is not incidental Each suite calls `next.start()` **inside the test body**, which `e2e-utils` caps at 60 seconds when no explicit timeout is given. Deployments now take about two minutes, so without this both would time out on every run — the same failure #99162 had to fix in `deprecation-warnings`. ## Verification Run against real deployments in deploy mode with **webpack**, which is the bundler PR CI does not cover: ``` PASS webpack typescript-version-warning 57.7s ✓ PASS webpack typescript-version-no-warning 81.6s ✓ ``` Also green in start mode with Turbopack. ESLint and Prettier clean. ## Two suites I deliberately left out These came from the same review of 19 suites that reported green in ~2.4s without running anything: - **`url-imports`** is correctly excluded. It starts a local static server on port 12345 and imports from it, so no deployment can reach its source regardless of bundler. Its `skipDeployment` is load-bearing. - **`webpack-loader-parse-error`** is already being enabled in #98850.🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by:Claude Opus 5 <noreply@anthropic.com>
-
Jamiboy Mohammad authored
## Summary Eleven suites carry `skipDeployment` on top of a condition that already keeps them out of deploy mode, so the option is dead weight. Each was run in deploy on the #99184–#99187 batches with the exclusion removed, and each reported green in roughly **2.4s** — the signature of a suite that registered no tests, not one that deployed and passed. So removing the option is behaviour-neutral. It also removes the `it.only` that `skipDeployment` registers, which focuses the whole *file* and can silently skip unrelated suites beside it. ## Why each genuinely cannot run against a deployment | suite | blocker | |---|---| | `app-action-export`, `invalid-custom-routes`, `invalid-middleware-matchers` | mutate fixture files after setup (`patchFile` / `deleteFile`), then rebuild | | `instant-validation-build`, `externals-pages-bundle` | call `next.build()` and read the local build output | | `telemetry/config`, `telemetry/page-features`, `telemetry/telemetry` | telemetry events are emitted by the local CLI process | | `cpu-profiling-build` | reads `.next-profiles` off disk, and already returns early on `isNextDeploy` | | `back-button-download-bug`, `next-test` | the whole suite is `describe.skip`, for reasons unrelated to deployment | ## Not in this PR From the same set of 19, four look like the *gating* is wrong rather than the exclusion being correct, and they need their own change plus a deploy run: - `typescript-version-warning` and `typescript-version-no-warning` use only `next.start` and `next.cliOutput`, and assert on build output that deploy does provide. They are excluded by an explicit `if (isNextDeploy || isNextDev)` that reads as caution rather than a finding. - `url-imports` uses only `render` and `browser`. Its `describe.skip` is Turbopack-specific and legitimate, so it needs the webpack deploy job rather than a code change. - `webpack-loader-parse-error` is already being enabled in #98850. And `invalid-module-document`, `undefined-webpack-config`, `typegen-error-diagnostic`, `turbopack-emit-collect` need the deferred-deployment-lifecycle conversion or a closer read first. ## Verification Deploy-mode runs on #99184–#99187 (Turbopack). Confirmed per file that canary carries one `skipDeployment` and this branch carries none, with no other change.
🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by:Claude Opus 5 <noreply@anthropic.com>
-
Will Binns-Smith authored
## Summary Use SWR Suspense for required analyzer datasets and move loading behavior into explicit Suspense and error boundaries. Split selected-route and valid-comparison subtrees so resolved route and module data has non-null contracts. Keep optional history, metadata, and one-sided comparison data nullable where absence is part of the UI state. ## Verification - `pnpm --filter=@next/bundle-analyzer-ui exec tsc --noEmit` - focused ESLint for changed files - `pnpm --filter=@next/bundle-analyzer-ui build` <!-- NEXT_JS_LLM --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Will Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
-
Hendrik Liebau authored
Adopts #99229. Closes #99229. A Server Action can hang on Vercel when the client navigates from `/a` to a PPR `/b` page and then calls an action owned by `/a`. The `/b` POST can carry postponed state. `app-page-runtime.ts` consumes the request stream to separate that state and saves the remaining action body as `actionBody`. The forwarding path reads `req.stream()` again, so its fetch waits on an exhausted stream until the function times out. The forwarding path now sends `actionBody` when it is present. It removes the source route's resume headers because the forwarded body no longer contains that state; the platform can attach the target route's state on the new request. Requests without a saved action body still use the request stream. The E2E test uses `connection()` to make `/b` PPR, warms its shell, navigates from `/a` to `/b`, and invokes an action imported only by `/a`. On a fresh Vercel deployment, it stays pending without this change and returns `pong` with it. The same test passes under `next start`, which does not receive the platform's prepended state. Fixes #99153 --------- Co-authored-by:Dmitrii Troitskii <jsleitor@gmail.com>
-
Will Binns-Smith authored
## Summary Size the treemap canvas from its content box so the backing store is not scaled to fit inside the bordered container. Recreate the backing store when the device pixel ratio changes. ## Verification - Manually verified treemap rendering and backing dimensions on standard- and high-DPI displays <!-- NEXT_JS_LLM -->
-
Will Binns-Smith authored
### What? Rename the Turbopack bundle analyzer option to `--snapshot-name` and use `snapshotName` in saved snapshot metadata and the comparison UI. Add an E2E regression test for live and historical metadata. ### Why? The custom label names a snapshot, not just a comparison baseline; the old term was misleading in the CLI and saved data. ### How? Carry the new option through the analyze pipeline into the snapshot metadata used by both live and historical views. The UI uses that metadata for display labels and picker search. The old CLI option and metadata field are not retained; existing snapshots containing only `baselineName` no longer show their custom label. ### Verification - Static wiring checks and `git diff --check` passed. - E2E test could not run locally: dependencies are not installed (`jest: not found`). <!-- NEXT_JS_LLM --> <!-- fleet ceb93e13-30fe-4be3-a35e-c7282c730c3d --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Will Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
-
Tobias Koppers authored
## Summary Follow-up to merged #99086, addressing [bgw’s Jest transformer review](https://github.com/vercel/next.js/pull/99086#discussion_r4100921785) and the remaining GitHub API rate-limit concern. The gate still waits for **any of the nearest three PRs** to pass its required check, failing closed if all three fail. Fork, leaf and first-three PR behavior is unchanged. - Refresh the current PR / branch-link topology every **20 minutes** while waiting; on each intervening **five-minute** poll, fetch only the up-to-three predecessor check statuses. Revalidate live PR revisions and checks before *any* success/failure decision. A changed decisive snapshot triggers an immediate topology refresh; repeated invalidation backs off. - Replace the bespoke TypeScript Jest transformer with `ts-jest`, using the action’s local pinned Jest 29 runner and peers. Keep independent `tsc --noEmit` typechecking and TypeScript 6.0.2. Refresh the compiled action and fake-timer tests. ### REST request rate per steadily waiting middle PR | Poll | Previous | New | | --- | ---: | ---: | | First poll and every 20 minutes | 8 | 8 (topology + up to 3 checks) | | 5/10/15 minutes between topology refreshes | 8 each | 3 each (checks only) | | **20-minute total** | **32** | **17** | | **Steady-state hourly rate** | **96/hour** | **51/hour (~47% fewer)** | This assumes one page per PR list, three predecessors and an unresolved wait. It is **not a hard per-PR or repo-wide ceiling**: a cold poll uses eight reads, decision-time live revalidation adds up to **3** (success) or **7** (all-failed) reads, and pagination, transient retries or an early topology refresh after changed data add calls. Changes that do not coincide with a decisive check can take up to 20 minutes to be detected; no cached state alone may release or fail the required gate. **Dependency caveat:** `ts-jest@29.4.5` declares a TypeScript `<6` peer range, while this repository pins TS 6.0.2. pnpm warns when adding the dependency; the separate action workspace pins Jest and its `ts-jest` peers to 29.x, and both the actual 27-case Jest suite and independent TypeScript check pass without suppressing errors. ## Verification - `pnpm --dir .github/actions/pr-stack-ci-gate install --frozen-lockfile --ignore-scripts` - `pnpm --dir .github/actions/pr-stack-ci-gate types` - `pnpm --dir .github/actions/pr-stack-ci-gate test` — **27/27** focused tests, including exact t=0/5/10/15/20 REST-call timings, stale-branch revalidation, a same-SHA rerun and a transient status-poll outage. - `pnpm --dir .github/actions/pr-stack-ci-gate build` — committed ncc bundle is reproducible; workflow YAML parses and the six-hour gate timeout remains. - `pnpm lint-no-typescript`, Prettier and `git diff --check`. - Live PR CI on signed head `1c0feed844b598b84736a849f72d4af7f2ff9831`: [compiled gate](https://github.com/vercel/next.js/actions/runs/36105343891/job/107976526834) **passed**, and [lint](https://github.com/vercel/next.js/actions/runs/36105343891/job/107976745858) **passed**, including frozen install, typecheck, bundle build and **27/27 Jest tests**. The [full build-and-test workflow](https://github.com/vercel/next.js/actions/runs/36105343891) completed **successfully on attempt 1**, including the required [`thank you, next`](https://github.com/vercel/next.js/actions/runs/36105343891/job/107984156677) check. A normal top/leaf PR runs immediately; its CI cannot exercise a 20-minute middle-PR wait. No six-PR draft-stack rebase is included in this follow-up. - README-wording-only follow-up head `f7d58fa85338f38b1a9876e308edb613104c5e8e`: [new build-and-test run](https://github.com/vercel/next.js/actions/runs/36184841154) **queued** at the time of this update. The previous full-CI pass belongs to `1c0feed8`, not this new SHA; no executable files changed. <!-- NEXT_JS_LLM --> <!-- fleet d2ae64f1-7106-4ba4-b88a-7785c19904c6 --> --------- 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>
-
Luke Sandberg authored
## Summary Give the long-running `next internal trace` server a recognizable process title with the Next.js version, matching the version format used by the build and server commands. Set the title when the trace command starts so both the WebSocket and MCP services appear under the same name, without changing their behavior. This way that `node` process consuming 40g of ram is a little easier to understand <!-- NEXT_JS_LLM --> <!-- fleet 1cc505a4-180a-44ae-8200-3af268332f61 --> 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>
-
Jamiboy Mohammad authored
## Summary Enable deployment coverage for 15 asset/compiler exclusion locations using the deferred deployment lifecycle from #98776. Replace local-only build calls with explicit start/failure assertions and retain the expected image, Sass, loader, foreign-package, and missing-dependency diagnostics. Preserve the existing development-only and bundler-specific exclusions. ## Verification - All applicable focused Turbopack production/development and Webpack production checks passed. - Local checks used the published native binding. Exact native and deploy validation are pending repository CI. <!-- NEXT_JS_LLM --> --------- Co-authored-by:Claude Opus 5 <noreply@anthropic.com>
-
Jamiboy Mohammad authored
## Summary Follow-up to #98847 and #98848, addressing [this review comment](https://github.com/vercel/next.js/pull/98847#discussion_r_placeholder) about the duplicate `isNextDev` check in `cache-components-edge-deduplication`. Several suites that gained deploy coverage branch on the test mode twice in a row: once to decide whether `next.start()` should resolve or reject, and again to pick the assertions. Each pair is folded into a single branch so the start call sits with the assertions that depend on it. Two suites that wrote `if (isNextDev) { ... }` followed by `if (!isNextDev) { ... }` now use a plain `else`, and `interception-routes-output-export` drops an `else if (isNextDev)` that could only ever be an `else`. No assertion changes. - `cache-components-edge-deduplication` - `cache-components-route-handler-errors` - `app-edge-invalid-reexport` — the start branch also folded the `isTurbopack` distinction in, so the "Turbopack fails, webpack warns" split is stated once - `generate-static-params-error` — the dev-only `beforeAll` moved into the dev branch - `interception-routes-output-export` - `catches-missing-getStaticProps` - `conflicting-public-file-page` ## Verification - `pnpm test-start-turbo` — 7/7 suites pass - `pnpm test-dev-turbo` — 7/7 suites pass - `pnpm test-start-webpack` — 6 pass, 1 skipped (`cache-components-edge-deduplication` is `@force-gate turbopack`) - `pnpm test-dev-webpack` — 6/6 applicable suites pass Local checks used the published native binding. Deploy validation is pending repository CI.
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by:Claude Opus 5 <noreply@anthropic.com>
-
Jamiboy Mohammad authored
## Summary Follow-up to #98848, addressing [this review comment](https://github.com/vercel/next.js/pull/98848#discussion_r4074331118) asking for a snapshot test. The Turbopack production assertion in `proxy-runtime` compared a hand-maintained `expected` literal against the CLI output with `toContain`, with the deploy differences patched up by a local `normalize` helper. It now extracts the build error section and asserts it with an inline snapshot, so the whole diagnostic is pinned — including the error count line and the trailing frame, which the substring match never covered — and can be regenerated instead of edited by hand. The normalization deploy needed (timestamp prefixes, code-frame indentation, dropped blank lines) runs in every mode now, so a single snapshot covers local and deploy builds rather than branching on `isNextDeploy`. ### Tests that were checked and left alone `use-cache-close-over-function` and `use-cache-hanging` have the same `expected` + `normalize` + `toContain` shape from #98847, but their build errors happen during page generation, so the surrounding output interleaves `Generating static pages using N workers (n/m)` lines — `N` follows the host's CPU count and the progress lines vary run to run. In `use-cache-close-over-function` the failing route also varies, which is why the existing assertion matches `"/(client|server)"`. A snapshot over that region would be flaky, so both keep their targeted substring assertions. `proxy-runtime` is snapshot-safe because its error is a compile error raised before page generation starts. ## Verification - `pnpm test-start-turbo` — passes, and a second run passes against the committed snapshot - `pnpm test-start-webpack`, `pnpm test-dev-turbo`, `pnpm test-dev-webpack` — pass (these take the unchanged non-Turbopack/dev branch) Local checks used the published native binding. Deploy validation is pending repository CI.
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by:Claude Opus 5 <noreply@anthropic.com>
-
Will Binns-Smith authored
### What? Make `pack-next` choose pnpm override locations from the destination workspace root's pinned `packageManager` version. ### Why? pnpm 11+ warns about `pnpm.overrides` in `package.json` and ignores that setting. Conversely, rewriting `pnpm-workspace.yaml` for older pnpm versions creates unnecessary churn. ### How? Use the repository's `semver` package to read the major from a pinned pnpm version. For a pnpm 11+ destination, merge overrides into the existing/detected pnpm workspace file without adding `pnpm.overrides` to `package.json`. For pnpm 10 and older, update only the package.json field. When the pin is missing or unusable, retain the previous dual-write behavior. Existing user overrides and npm/Yarn override behavior are preserved. ### Verification - Passed eleven temporary destination scenarios covering pinned older/newer pnpm, existing overrides and workspace files, nested workspace roots, and unknown versions. - Prettier check, Node syntax check, and `git diff --check` passed. - Repo-wide lint/typecheck not run (root dependencies are not installed in this checkout). <!-- NEXT_JS_LLM --> <!-- fleet e86eb7e1-c05e-4e30-9285-7c5595ccb36f --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Will Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
-
Will Binns-Smith authored
## Summary Move bundle comparison into a dedicated `/compare` route and persist the selected baseline, comparison snapshot, route, and view in URL search parameters. This makes comparison views linkable and separates the App Router route entries from the shared client implementation. Use root-relative data URLs and proxy historical snapshots during development so analyzer data continues to load from nested routes. Follow-up to review feedback on #93521. ## Verification - `pnpm --filter=@next/bundle-analyzer-ui build` <!-- NEXT_JS_LLM -->
-
Luke Sandberg authored
Remove a number of functions from `Transition` that are never overridden and had trivial implementations. This reveals that the default `process_context` function is making a copy of the module context simply without the `transition` (makes sense) but also with the `replace_externals` property reset to `true`. It isn't clear if that is intentional? This is just a code health thing no real perf win expected (save a tiny bit of code size)
-
Jamiboy Mohammad authored
## Summary Edge App Router SSR always enabled streaming metadata, so requests matching the default HTML-limited bot list could receive an initial `<head>` without their delayed metadata. Use the same user-agent-based metadata policy as Node SSR so matching requests receive their metadata before `</head>`. Add regression coverage asserting the default streaming and blocking behavior in both Edge and Node runtimes. Twitterbot and TelegramBot receive their metadata in the initial head; ChatGPT-User, GPTBot, ClaudeBot, and browser requests continue to stream metadata. Also verify that delayed metadata eventually arrives in both runtimes. The default bot list is unchanged, and the tests do not override `htmlLimitedBots`. Related to #98748; this addresses the Edge runtime bug without making assumptions about how these bots consume streamed responses. ## Verification - Production regression suite: 14 tests passed with Webpack and 14 with Turbopack. - Full native bootstrap failed at `cargo metadata`; JavaScript build succeeded. Tests used the installed SWC 16.4.0-canary.38 binary with Next.js 16.4.0-canary.40. <!-- NEXT_JS_LLM -->
-
next-js-bot[bot] authored
-
Hendrik Liebau authored
Static root-param tracking for `'use cache'` needs to distinguish which getters a cached module imports. The existing generated module contains every getter, so module-level dependency collection includes unrelated root params. `next/root-params` now re-exports each getter from a separate virtual module. The generated `next/root-params` module declares that it has no side effects, so Turbopack resolves named imports without including unrelated getter modules. Runtime root-param tracking remains unchanged. The split also keeps code hashes stable when unrelated root params are added. The regression test checks this dependency isolation through the existing code-hash manifest.
-
Sebastian "Sebbie" Silbermann authored
Test passes without adapter: https://github.com/vercel/next.js/actions/runs/36130462440/attempts/2 Forked assertions with a clear statement what the intended behavior is would be more helpful. Co-authored-by:
Claude Code (kimi-k3[1m]) <noreply@anthropic.com>
-
Tobias Koppers authored
### What? Limit Turbopack's package-origin project-root tracing to statically named **files**, while resolving the complete original request relative to the package as before. This applies to filesystem, directory, child-process and Node worker references. ### Why? Static does not necessarily mean narrow: `node-gyp-build`'s `path.resolve(dir || '.')` contains a static `'.'` branch. Tracing that from the application root as a directory recursively includes unrelated application assets. We still need packages to find explicitly named application config files. ### How? Analysis records two candidate contexts without inspecting the filesystem: an optional app-root context for static file paths, and a package-local fallback for the original request. At reference resolution, the app-side lookup keeps only fully static file matches; directories and symlinked directories cannot recursively expand there. The package-side lookup independently traces the full pattern, including dynamic alternatives and directory contents. Both results are combined so even a mixed file/directory expression can retain its app config **and** package-local assets; the combination preserves distinct files sharing a request key and deduplicates identical modules. Protobuf `includeDirs` uses the same reference path. Regression fixtures cover a `node-gyp-build`-style `'.'` fallback, mixed file/directory alternatives with same-named files in both contexts, symlinked directories and files, a missing optional config, and Node worker references. The webpack/@vercel/nft path is unchanged. **Verification:** 93 tracing tests and 65 core resolve tests pass; focused Clippy with warnings denied, Rust formatting and diff checks pass. Production next-site size impact has not been independently measured in this fixture. Related: #98628, #98712, #99080. <!-- NEXT_JS_LLM --> <!-- fleet fe000a60-fbb8-4835-b6ef-38d5684822a9 --> --------- 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>
-
next-js-bot[bot] authored
-
Sebastian "Sebbie" Silbermann authored
This produces a new dependency chain which can lead to duplicate Next.js version in monorepo setups. Specifically, the internal sync is broken. It can probably be fixed with some dependency graph doctoring but we need to investigate and document that first. We're close to a stable release and the sync has been blocked all week so getting it back on track has priority. Reverts https://github.com/vercel/next.js/pull/98862
-
Tobias Koppers authored
### What? Stabilizes the Turbopack development test that verifies an invalid dynamic-import target stays unparsed until activation, while checking both server compilation output and the browser-visible error overlay afterward. ### Why? Activating the target can trigger an incidental hard reload as Fast Refresh recovers from the error. A one-shot overlay source read can race that document replacement. The test should check the error it owns without requiring a reload or accepting an absent overlay. ### How? The test retains canary's CLI-output assertion and independently retries a live browser-redbox source assertion filtered to the expected parse-error marker. Playwright re-resolves the locator across document changes; both signals must actually contain the marker. ### Verification - Focused Turbopack dev case under six competing CPU workers: 20/20 passed on rebased canary - Complete `lazy-dynamic-imports` Turbopack dev file: 3/3 passed on rebased canary - Related `next/dynamic` error-overlay case: 10/10 passed on rebased canary - Prettier, ESLint, clean merge-tree, and diff checks <!-- NEXT_JS_LLM --> <!-- fleet 2dd4f041-bfb3-4572-9b57-5cb45a2410cd --> --------- 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>
-
Luke Sandberg authored
When deleting a task, remove the reverse dependeny edges also. Generally this should be empty, but there can be tasks if those tasks are owned by a root that is pinned but not active. So in the rare case that such tasks are 'reactivated' this also dirties the task. This closes a hole where a task with a cell_dependency can reference a deleted task. Then new test demonstrates the bug, without the fix it will panic when collecting the second task
-
Tobias Koppers authored
### What? Replace the Graphite-specific CI optimizer with a **read-only TypeScript gate** for PR stacks formed by ordinary GitHub base/head branch links. This PR includes the work previously reviewed in #99116 and #99122. ### Why? Rebasing a large stack starts expensive `build_and_test` jobs on every PR at once. Let the first three PRs and the top PR run immediately, but defer middle PRs until nearby CI provides a useful signal. A deferred PR must **not** appear mergeable just because its jobs have not started. ### How? - **Find the stack from branch relationships**, not GitHub stack metadata. Middle PRs poll their three nearest predecessors every **five minutes**. Any predecessor with a successful, current-head/current-base `thank you, next` check releases full CI; three unsuccessful results **fail the gate and required aggregate**. While waiting, the gate stays in progress. After five hours without a decision, it releases full CI rather than stranding the PR. - **Revalidate before deciding.** Refresh PR and check data before release/failure so rebases, retargeting and reruns cannot make a stale check decisive. Transient GitHub 5xx/429 errors retry; permanent errors or ambiguous topology start full CI rather than claiming CI passed. - **Keep polling cheap and read-only.** Reuse PR head/base data from `pulls.list` (11 → **8 REST reads** per ordinary waiting poll), while still checking *all three* predecessors. The bundled action is checked out at the current test-merge `${{ github.sha }}` without persisted credentials; forks bypass the checkout/gate and run full CI. The six-hour gate stays on `ubuntu-latest` because `ubuntu-slim` has a 15-minute limit. <details> <summary>Implementation and review tradeoffs</summary> - The local action bundles a pinned Octokit. Isolated Jest tests use fake timers and a real check-run response fixture. CI runs the existing Next.js lint/examples/externals/browser checks before action-specific install, typecheck, build and Jest; a generated-diff guard catches stale bundles. - `uses: ./...` requires action files already in the job workspace; it does not fetch them like `owner/repo@ref`. The sparse checkout fetches only `action.yml` and `dist/index.js`. Caller and reusable workflow grant read-only `checks`, `contents` and `pull-requests` permissions; the gate inherits no secrets. - Cheap-check graph splitting was deliberately deferred. Job-level concurrency does not enforce predecessor *success*; stopping at the first pending predecessor misses an older success. GraphQL batching needs a verified check-association projection and measured cost before replacing the current REST lookup. - When the child commits became reachable from this branch, GitHub automatically marked #99116 and #99122 merged; no PR merge operation was used. [Action README](https://github.com/vercel/next.js/blob/ci/branch-stack-polling-gate/.github/actions/pr-stack-ci-gate/README.md) documents the contract. </details> ### Verification - **Focused checks:** TypeScript, Prettier, deterministic bundle/diff checks and **24/24 Jest** passed. The final comment-only change in `src/gate.ts` produced a byte-identical bundle. The [current root run](https://github.com/vercel/next.js/actions/runs/35967795126) passed its gate, lint and required `thank you, next` on **attempt 2** (same SHA); attempt 1 failed an intermittent redbox test. - **Live six-PR test on the compiled action:** the first three and top passed the gate immediately. Middle #99097 and #99098 **waited**. On initial attempts, both **failed closed** when their three predecessors were unsuccessful, with no expensive jobs started. On rerun, #99097 **released on #99086's success** despite #99096 failing and #99095 still pending; full CI ran but failed unrelated tests. #99098 waited for *its own* three predecessors, then failed closed again. Gate release never marked full CI successful. - **Known limitation:** product-test failures—not the gate—left four immediate/released PRs with failed full CI on various attempts. All five test drafts remain open for reuse. Workflow reruns in this experiment were initiated externally; this agent's GitHub integration received 403 (`actions=write` required) when attempting a rerun. <details> <summary>Current compiled-action six-PR results, with workflow and gate logs (2026-09-24)</summary> Each draft is one Jest assertion commit over its signed parent; the cumulative focused suite passes **24/24**. Times below are UTC. “Required” refers to `thank you, next`, not the gate check. | Position | PR / signed head / workflow | Gate outcome | Required check | Expensive work | | :-- | :-- | :-- | :-- | :-- | | 1 | [#99086](https://github.com/vercel/next.js/actions/runs/35967795126) `85444c9e` | immediate pass | failed attempt 1; **passed attempt 2** | ran twice | | 2 | [#99095](https://github.com/vercel/next.js/actions/runs/35969902709) `bc19787a` | immediate pass | failed attempts 1 and 2 | ran twice | | 3 | [#99096](https://github.com/vercel/next.js/actions/runs/35970016367) `98bfab58` | immediate pass | failed | ran | | 4 | [#99097](https://github.com/vercel/next.js/actions/runs/35970109573) `e260bf96` | [attempt 1](https://github.com/vercel/next.js/actions/runs/35970109573/job/107537584401): waited → failed 08:02; [attempt 2](https://github.com/vercel/next.js/actions/runs/35970109573/job/107609256427): **released 11:19** | failed both attempts (attempt 2: product tests) | none on attempt 1; full CI ran on attempt 2 | | 5 | [#99098](https://github.com/vercel/next.js/actions/runs/35970206069) `01222d4a` | [attempt 1](https://github.com/vercel/next.js/actions/runs/35970206069/job/107537887530): waited → failed 08:03; [attempt 2](https://github.com/vercel/next.js/actions/runs/35970206069/job/107609367420): waited → failed 11:50 | failed both attempts | **never started** | | 6 (top) | [#99099](https://github.com/vercel/next.js/actions/runs/35970312588) `c6f3cf4a` | immediate pass | failed attempts 1 and 2 | ran twice | **Decision evidence:** On attempt 1, #99097 saw #99096/#99095/#99086 all unsuccessful, and #99098 saw #99097/#99096/#99095 all unsuccessful; their required checks failed and downstream jobs were skipped *because their gates failed*. After #99086's successful rerun, #99097 attempt 2 logged `#99096=unsuccessful, #99095=waiting, #99086=success`; its gate passed and [build-next actually ran and passed](https://github.com/vercel/next.js/actions/runs/35970109573/job/107609336752). #99098 could not use #99086 (outside its nearest-three window); it failed at 11:50 when #99097/#99096/#99095 had all finished without success. Completed failed gates do not restart automatically when a predecessor reruns. </details> <details> <summary>Unrelated CI failures and recovered flaky tests</summary> - #99086's attempt 1 failed `lazy-dynamic-imports › does not parse a dynamic import target before activation`: redbox source was `null` after all in-job retries ([job](https://github.com/vercel/next.js/actions/runs/35967795126/job/107530613870)). **The same-head workflow passed on attempt 2.** - #99095, #99096, #99097 attempt 2 and #99099 failed `instant-insights-tab-overlay › should wrap the mobile overlay header only when it does not fit`: observed header top difference **24**, expected **< 4**, after in-job retries ([example job](https://github.com/vercel/next.js/actions/runs/35969902709/job/107537341995)). #99096 also failed `turbopack-loader-file-dependencies › should update when a build dependency changes` (`build-one` instead of `build-two`, [job](https://github.com/vercel/next.js/actions/runs/35970016367/job/107537932737)). #99097 attempt 2 additionally failed the `lazy-dynamic-imports` redbox assertion in an experimental cache-components shard ([job](https://github.com/vercel/next.js/actions/runs/35970109573/job/107609732882)). These failures are not gate-test failures. - **Recovered in-job flakes:** #99096 `instant-validation/head-and-reporting › invalid - runtime prefetch - dynamic viewport blocks navigation` (redbox did not open; passed retry 1/2); #99095 `use-cache-without-experimental-flag › should recover from the build error if useCache flag is set` (Playwright execution context destroyed on navigation; passed retry 1/2); #99097 attempt 2 `lazy-dynamic-imports` in a different Turbopack-dev shard (passed retry 2/2), `instant-validation/suspense-boundaries` (redbox did not open; passed retry 2/2), and `instant-validation/head-and-reporting.partial-prefetching` (redbox did not open; passed retry 1/2). </details> <details> <summary>Earlier implementation smoke tests and CJS-gate stack runs</summary> - The [folded-code root head `89f0ca34` full run](https://github.com/vercel/next.js/actions/runs/35965443069) passed gate, build, lint (including **24/24 Jest**) and required `thank you, next`. The earlier [compiled-action child head `25647f00` run](https://github.com/vercel/next.js/actions/runs/35922700289) also passed full CI, proving same-SHA sparse checkout before the lint-order follow-up was folded into root. - **CJS-gate fail-closed run (base `ec0abf41`, 2026-09-23):** [#99086](https://github.com/vercel/next.js/actions/runs/35875541530), [#99095](https://github.com/vercel/next.js/actions/runs/35875598833), [#99096](https://github.com/vercel/next.js/actions/runs/35875651890) and top [#99099](https://github.com/vercel/next.js/actions/runs/35875952426) ran full CI and failed unrelated tests. Middle [#99097](https://github.com/vercel/next.js/actions/runs/35875701404/job/107231099534) failed its gate at 15:20 and [#99098](https://github.com/vercel/next.js/actions/runs/35875873698/job/107231827956) at 15:21; required checks failed and expensive jobs never started. A Turbopack source-map snapshot failure was subsequently fixed in [#99106](https://github.com/vercel/next.js/pull/99106). - **CJS-gate release run (base `8ff7f2bd`, 2026-09-23):** [#99086](https://github.com/vercel/next.js/actions/runs/35887913444) and [#99095](https://github.com/vercel/next.js/actions/runs/35887957948) passed full CI. [#99097](https://github.com/vercel/next.js/actions/runs/35888074168/job/107273254039) and [#99098](https://github.com/vercel/next.js/actions/runs/35888146874/job/107273514756) waited, then released at the next poll on #99095's green check while a nearer predecessor was unresolved. Their later full CI failed; top [#99099](https://github.com/vercel/next.js/actions/runs/35888202575) started immediately (later canceled). These precede the TypeScript action and are not claimed as evidence for its current head. </details> <!-- NEXT_JS_LLM --> <!-- fleet d2ae64f1-7106-4ba4-b88a-7785c19904c6 --> --------- 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>
-
Andrew Clark authored
The prefetch scheduler's static walk decided at the parent which child was still part of the current page and which began the new part of the route, and it fetched the head through two functions of its own that copied the per-segment decision (a static attempt, then a runtime deopt if that wasn't enough) for a node that hangs off the route root instead of sitting in the tree. Give the walk the same shape as the navigation's. The walk over the part of the route the current page also has owns the comparison for its own node — first whether the route position still matches, then whether any of its params changed — and hands off to the walk over the new part of the route when either fails, so the root enters the shared walk like every other node. The per-segment decision, a static attempt or a runtime deopt, lives in one function that the new-part walk calls for every segment, and the runtime request's walk gets the same split between iterating the children and deciding for one node. The head is a one-node route tree like any other segment now, so it goes through the same functions: the new-part static walk and the direct runtime fetch it already had. This is a pure restructuring and issues the same requests as before: a segment the navigation keeps is still prefetched at the ordinary static tier without a runtime deopt, the head is still fetched whenever anything is, and a chain of inlined segments is still dropped where a Shell-phase walk crosses from a kept node into the new part. A later change uses the shape to prefetch only what the navigation would fetch.
-
Andrew Clark authored
Changing a page’s search params doesn’t change which page it is, but it may change the data that page needs. The router currently mixes these concerns by appending search params to `__PAGE__` segments. Remove that encoding so we can compare which route is being rendered separately from the param values used to render it. Param values are now compared through the existing VaryPath data structure, while route structure is compared during the existing tree traversals. Each traversal can decide which comparisons matter for the work it’s doing. Client-side comparisons and history restoration still need the search params, so store them in a separate FlightRouterState slot for now. As before, previous-page search params are stripped from normal request headers. This is a temporary step that lets us migrate incrementally. Eventually, FlightRouterState will be replaced by a type that represents the route and its params more directly. This is mostly a refactor, though it fixes an accidental inconsistency in search-param handling compared with regular route params, avoiding some redundant prefetch work. Fully cached pages already track their vary params correctly. This separation prepares us to do the same for partially dynamic segments during navigation, so changing an unrelated param won’t require rendering their dynamic content again.
-
Andrew Clark authored
Throughout most of the client router implementation, the head is treated as if it belongs to the page segment. For example, CacheNode has separate `rsc` and `headRsc` fields, and the page's CacheNode owns both. This had led to a bunch of special cases related to the head. The Segment Cache largely (though not entirely) avoids this by instead modeling the head as a special kind of segment. It has its own vary path, its own SegmentCacheEntry, etc. There are still a few places where treatment of the head is special, because it doesn't exist inside the normal route tree structure. But we treat it like segment wherever possible. This PR updates the navigation implementation to use the same model: treat the head as a segment that is a sibling to the route segment tree. This is a large diff but the changes are almost entirely mechanical. Although the added/removed balance is about even, that includes a new test case. The net number of implementation lines has gone down.
-
Andrew Clark authored
Adds a `varyParams` field to CacheNode. When present, they represent the set of params that the data for that segment varies by. (When null, the set is unknown.) Currently, the vary params are only known when the data is fully cached; vary params are not recorded during a dynamic render. However, this will change in a future PR once we've integrated with the experimental Ledgers feature in React.
-
Andrew Clark authored
Refactors the CacheNode tree to use the RouteTree<T> data type. CacheNode used to be a tree-shaped object, with a similar structure to RouteTree<T>. CacheNode is now a data container instead, embedded inside a RouteTree structure. So the usage sites change from CacheNode to RouteTree<CacheNode>. As a result, we can now diff against the render tree directly during prefetches and navigations, instead of diffing against FlightRouterState. This gets us closer to migrating everything away from FlightRouterState to our shared data types.
-
Andrew Clark authored
Part of a series of internal refactors to improve param tracking on the client. A route tree node used to come in two variants, a layout and a page, distinguished by an isPage flag that every constructor had to keep consistent with the VaryPath it built. The variants only differed in whether the vary path carried a search params entry, and the code that needed to know either checked the flag or read the vary path's shape positionally. Collapse them into one RouteTree type with one VaryPath type. The few places that still care whether a node is a page derive it from the segment. When something needs to read the search params, they can be accessed from the RouteTree or VaryPath like we do for other params. This is a pure refactor of the existing code. It reads more naturally with a single tree type and a single vary path type, which the rest of this stack builds on.
-
Luke Sandberg authored
Fix the definition of GC roots to account for all transient references There was a categorical mistake in how `uppers` and `collectible_dependents` were interpreted. Both of these refer to a task above us and this is it is a reference but the reference might be comming from transient or persistent tasks. This is what kept confusing the 'root' definition So the new definition is simply * You are collectible if there are no references (persistent or transient) * You are a root if there are only transient references, which includes transient uppers and collectible_dependents The old definition expected roots to have no uppers at all, which isn't correct. A `run_once` task becomes an aggregation root and so the nested persistent tasks reference it as an upper. Those tasks should become gc roots since they are on the transient <--> persistent boundary and the only thing retaining them is references from transient tasks.
-
Luke Sandberg authored
## What When removing edges, only enqueue `lost follower` jobs when we actually remove children. ## Why GC can race with other kinds of task completion which also remove outgoing edges. If task completion drops a child from a task that also becomes collectible. Then it is possible for there to be an enqueued CleanupOldEdges job at the time GC runs. Then we will have two jobs that remove children, only one will succeed but both will enqueue `InnerOfUppersLostFollowersJob` for all the chidren. This can lead to panics since one of those jobs will fail to remove the follower The fix is simple, only remove tasks as followers when you actually removed them as children.
-
Luke Sandberg authored
Fix refcounting for transient tasks - ensure transient tasks refcount each other correctly, and are eligible for collection - ensure root tasks are born with a transient_ref_count of 1 Also drop some ultimately harmful conditions from the gc predicate - don't consider `cell_dependent`. cell dependencies form cycles and are subsumed by ancestors - to read a cell you have to read it from a child (covered by parent_count) or be passed it from a parent. For the parent to have passed it to you it must have a child dependency on the producer or be passed it by its parent (recursively). So the task that passed you the vc must be holding ownership over both tasks. - therefore a stale cell_dependency can only exist within a task that is effectively dead, however because we do not reliably clean up all tasks in a session (due to leaking root tasks), we cannot fully exclude the existence of stale cell_dependency edges. We just know they must only exist within unreachable tasks. --------- Co-authored-by:Claude Opus 5 (1M context) <noreply@anthropic.com>
-