- 19 Mar, 2026 26 commits
-
-
nextjs-bot authored
-
JJ Kasper authored
When invoking `handler` exports directly without `base-server` we need to ensure span names are still updated with the route correctly so not just method name is in span name.
-
Luke Sandberg authored
### What? Fixed Turbopack incorrectly trying to resolve inline JavaScript code as module references when `new Worker()` is called with `{ eval: true }` option. Now we skip creating a reference when `eval:true`, and report warnings if we cannot tell what the value is ### Why? Libraries like jsPDF create Worker threads by passing inline JavaScript code as the first argument along with `{ eval: true }` as the second argument. Turbopack was incorrectly treating this inline code as a file path and attempting to resolve it as a module reference, causing build failures. ### How? Added logic to detect when the `eval: true` option is passed to the Worker constructor. When this option is present, Turbopack now skips creating a worker reference since the first argument contains executable code rather than a file path. Added comprehensive test coverage using jsPDF to verify the fix works correctly. Fixes #91642 -
Josh Story authored
Tests that unstable_instant configs placed at different positions across a parallel route fork correctly attribute errors to the blocking segment, with the cause pointing to the config that requires instant behavior. Includes both invalid cases that produce errors and valid cases that pass cleanly. Does not yet detect incompatible configurations like false on one slot alongside an instant config on a sibling — that will be handled in a followup.
-
Hendrik Liebau authored
[Flakiness metric](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.name%3A%22Client%20navigation%20with%20URL%20hash%20when%20hash%20changes%20with%20state%20when%20passing%20state%20via%20hash%20change%20should%20increment%20the%20history%20state%20counter%22%20%40test.type%3A%22turbopack%22%20%40test.status%3A%22fail%22&agg_m=count&agg_m_source=base&agg_t=count&fromUser=false&index=citest&start=1773314950142&end=1773919750142&paused=false) (for one of them) Another case where the Playwright upgrade exposed missing `retry`s.
-
JJ Kasper authored
Continues https://github.com/vercel/next.js/pull/91603 applying the encoding normalization further and narrows in a better regression test separate of root params and specific to vary params flag.
-
Tim Neutkens authored
This reverts commit 058d950b.
-
Josh Story authored
Add per-slot error attribution for instant validation using slot markers and config depth preference (#91610) When a validation boundary spans multiple parallel slots, errors were previously attributed to whichever unstable_instant config was found first during tree iteration — which varied between turbopack and webpack. This made the "Caused by: Instant Validation" source non-deterministic and sometimes pointed to the wrong slot's config. This adds a SlotMarker client component that wraps each slot's content at fork points (where parallel routes > 1). The marker's dynamically-named inner function appears in the SSR component stack, allowing resolveInstantStack to identify which slot an error belongs to and look up that slot's config. When a slot has no config, it falls back to slotStacks[0] (the root config). The root config is now selected by config depth preference rather than first-found. configDepth tracks how many URL-consuming segments deep a config was found, with deeper configs preferred as more specific. At equal depth, the children slot is preferred over named slots. This ensures deterministic attribution regardless of bundler iteration order. Key changes: - SlotMarker component in boundary-impl.tsx takes a name prop and lazily creates named inner functions cached by name - slotStacks array replaces the singleton createInstantStack on InstantValidationState (index 0 = root config, 1+ = per-slot) - configDepth on TreeResult only counts URL-consuming segments — synthetic segments like (__SLOT__), __PAGE__, and route groups don't contribute - resolveInstantStack parses component stacks for slot markers and maps to the correct config - wrapSlotsWithMarkers called at every fork in both buildSharedTreeSeedData and buildNewTreeSeedData
-
Hendrik Liebau authored
- [Flakiness metric for `should handle redirects to routes that provide an invalid RSC response`](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.name%3A%22app-dir%20action%20handling%20fetch%20actions%20should%20handle%20redirects%20to%20routes%20that%20provide%20an%20invalid%20RSC%20response%22%20%40test.type%3A%22nextjs%22%20%40test.status%3A%22fail%22&agg_m=count&agg_m_source=base&agg_t=count¤tTab=overview&eventStack=&fromUser=false&graphType=flamegraph&index=citest&start=1773313490002&end=1773918290002&paused=false) - [Flakiness metric for `should work with interception routes`](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.name%3A%22app-dir%20action%20handling%20should%20work%20with%20interception%20routes%22%20%40test.type%3A%22nextjs%22%20%40test.status%3A%22fail%22&agg_m=count&agg_m_source=base&agg_t=count&fromUser=false&index=citest&start=1773313571516&end=1773918371516&paused=false)
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Jimmy Lai authored
## Summary Run existing app-dir tests with `__NEXT_USE_NODE_STREAMS=true` in CI to validate the node stream rendering path alongside the default web stream path. - New CI job in `build_and_test.yml` that runs a curated set of app-dir tests with the flag enabled - `test/use-node-streams-tests-manifest.json`: manifest of tests to run in node-stream mode ## Test plan - [x] CI job triggers and runs tests successfully - [x] Does not affect existing CI jobs --------- Co-authored-by:Tim Neutkens <tim@timneutkens.nl>
-
Tim Neutkens authored
## What Rename the HMR WebSocket path from `/_next/webpack-hmr` to `/_next/hmr`. ## Why The `webpack-hmr` name is a leftover from when webpack was the only bundler. Now that Turbopack is the default bundler for both `next dev` and `next build`, the path name is misleading. The generic `/_next/hmr` better reflects that this endpoint is bundler-agnostic. ## Changes - **Client source** (`page-bootstrap.ts`, `web-socket.ts`): updated the WebSocket connection path - **Server** (`router-server.ts`): updated the HMR request detection path - **Turbopack** (`turbopack-dev-server/src/lib.rs`): updated the fallback WebSocket path check - **Tests**: updated all test files referencing the old path - **Docs** (`version-12.mdx`): added a note that the path was renamed to `/_next/hmr` in Next.js 16, while keeping the original v12 examples intact
-
Tim Neutkens authored
## What? Split out these changes from #89859. Only adds more plumbing for future Node.js streams feature.
-
Tim Neutkens authored
## What? Extracts the bundling infra to have the Node.js streams experimental flag out of #89859 This only adds the bundle and the v8-jit skill. It does not use the bundle yet, and it's not switching code base on the env var. There will be follow-up PRs for those.
-
Jiwon Choi authored
## Summary - Add `.agents`, `.claude`, and `.cursor` to the `docs` group in `CHANGE_ITEM_GROUPS` in `scripts/run-for-change.mjs` - Changes to these directories (agent skill definitions, editor configs) don't affect Next.js build/runtime/tests, so CI should skip for them — same as docs-only changes - Both `build_and_deploy.yml` and `build_and_test.yml` already use `run-for-change.mjs --not --type docs` to detect non-docs changes; this extends that behavior to agent/editor config files
-
Hendrik Liebau authored
[Test duration metric](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.name%3A%22deterministic%20build%20-%20changing%20deployment%20id%20build%20output%20API%20-%20standard%20builder%20should%20produce%20identical%20build%20outputs%20even%20when%20changing%20deployment%20id%22%20%40test.type%3A%22turbopack%22%20%40test.status%3Apass&agg_m=count&agg_m_source=base&agg_t=count&fromUser=false&index=citest&start=1773311049123&end=1773915849123&paused=false) The test frequently times out in CI. When it succeeds, it runs close to the 60 second timeout limit, so we increase it to 120 seconds to reduce flakiness.
-
Hendrik Liebau authored
[Flakiness metric](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.name%3A%22server-components-hmr-cache%20should%20support%20reading%20from%20an%20infinite%20streaming%20fetch%22%20%40test.status%3Afail%20%40duration%3A%3E%3D1ns&agg_m=count&agg_m_source=base&agg_t=count&fromUser=false&index=citest&start=1773310422894&end=1773915222894&paused=false) This test times out frequently on slow CI machines. To fix this, we're removing the low custom 10 second test timeout (using the default 60 second timeout instead).
-
Tobias Koppers authored
### What? Extends the CSS parse warning severity improvements in `turbopack/crates/turbopack-css/src/process.rs`. Canary (#90025, #91513) already: - Added a `severity` field to `ParsingIssue` and a `fn severity()` override - Demoted `UnsupportedPseudoClass` / `UnsupportedPseudoElement` selector errors from `Error` to `Warning` - Still **silently dropped** all other unrecognized parser warning kinds (`_ => { // Ignore }`) This PR completes the work: 1. **Surfaces all previously-ignored parser warnings as `IssueSeverity::Warning`** — the `_ => { // Ignore }` arm now emits a `ParsingIssue` at `Warning` severity instead of discarding it. 2. **Refactors the warning loop** — the nested severity match inside the existing `match err.kind` arm is replaced with a single top-level `let severity = match err.kind { … }` followed by an unconditional emit. This is cleaner and makes the severity logic easier to follow. Hard parse/transform errors (`Err(e)` from `parse_css_stylesheet`, minify errors, CSS module pure-selector errors) are unchanged — they remain `IssueSeverity::Error`. ### Why? Silently dropping parser warnings hides useful diagnostic information from developers. Surfacing them as `Warning` gives visibility without marking the build as broken. The restructure also avoids a redundant `UnsupportedPseudoClass`/`UnsupportedPseudoElement` check inside a nested match — the top-level arm order (specific pseudo variants before the catch-all `SelectorError(..)`) handles precedence correctly. ### How? - Removed the now-unused `error::SelectorError` short import (fully-qualified paths are used in the match). - Replaced the `match err.kind { <arms that emit> … _ => { // Ignore } }` pattern with: 1. `let severity = match err.kind { UnsupportedPseudo* => Warning, hard errors => Error, _ => Warning };` 2. Unconditional `IssueSource` construction and `ParsingIssue { severity, … }.emit()`. Co-authored-by:Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by:
Claude <noreply@anthropic.com>
-
Tobias Koppers authored
turbo-persistence: fix mmap page alignment and improve error context in MetaFile::open_internal (#91640) ### What? Two changes to `turbopack/crates/turbo-persistence/src/meta_file.rs` and `mmap_helper.rs`: 1. **Bug fix: mmap page alignment** — `MmapOptions::offset()` requires the offset to be page-aligned (typically 4096 bytes), but the code was passing `file.stream_position()` (the byte position after reading the variable-length header), which is not guaranteed to be page-aligned. This would cause `mmap` to fail or behave incorrectly on some inputs. 2. **Improved error context** — Add `.context("...")` to all `?` operators in `open_internal` (except read calls) and inside `advise_mmap_for_persistence`, so errors carry actionable context. The filename is already attached by the `MetaFile::open` wrapper, so no filename is repeated in these messages. ### Why? The mmap offset bug could cause silent failures or panics when the meta file header length is not a multiple of the OS page size. The missing error context made it hard to diagnose failures in production. ### How? **mmap fix (`meta_file.rs`):** - Remove `options.offset(offset)` — map the entire file from byte 0 instead. - Add a new `amqf_data_start: usize` field to `MetaFile` storing the header-end byte offset. - `amqf_data()` now returns `&self.mmap[self.amqf_data_start..]`, exposing only the AMQF data region. All existing callers that index into `amqf_data()` continue to work unchanged since their offsets are already relative to the start of AMQF data. **Error context (`meta_file.rs`):** - `File::open(path)?` → `.context("Failed to open meta file")` - `file.stream_position()?` → `.context("Failed to get stream position")` - `unsafe { options.map(&file) }.with_context(|| format!(...))` → `.context("Failed to mmap")` (drop the closure and filename, already provided by the outer wrapper) - `mmap.advise(Advice::Random)?` → `.context("Failed to advise mmap")` **Error context (`mmap_helper.rs`):** - `Advice::DontFork` → `.context("Failed to advise mmap DontFork")` - `Advice::Unmergeable` → `.context("Failed to advise mmap Unmergeable")` Co-authored-by:Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by:
Claude <noreply@anthropic.com>
-
Tobias Koppers authored
## What? Adds support for `this.importModule()` in Turbopack's webpack loader compatibility layer. This API allows webpack loaders to dynamically import and execute modules (CJS, ESM, TypeScript, JSON, WebAssembly, etc.) during the build process, matching webpack's native `this.importModule()` behavior. ## Why? Webpack loaders like `@vanilla-extract/webpack-plugin`, `val-loader`, and custom loaders use `this.importModule()` to: - Load configuration files that are themselves modules with dependencies - Execute code at build time to generate derived source - Process dependency chains (e.g., a TS config that imports a CJS module that requires JSON) Without this, loaders relying on `importModule()` cannot work with Turbopack. ## How? ### Architecture The implementation follows a request/response pattern between the Node.js loader runner and the Rust-side Turbopack compiler: 1. **Loader calls `this.importModule(request)`** in the Node.js loader runner 2. **IPC message sent to Rust** with the module request and lookup path 3. **Rust resolves the module** using Turbopack's full resolver (with aliases, loader rules, etc.) 4. **Rust builds a Node.js bundle** containing the module and all its dependencies using Turbopack's code generation pipeline 5. **Bundle chunks sent back to Node.js** via IPC 6. **Node.js evaluates the bundle in-memory** using `vm.compileFunction` with a minimal CJS module system This approach leverages Turbopack's full module graph, so imported modules benefit from the same resolution (aliases, custom loaders, TypeScript support, etc.) as regular imports. ### Key Changes **Rust side (`turbopack-node/src/transforms/webpack.rs`):** - New `ImportModule` IPC response message type - Resolves modules through Turbopack's `esm_resolve` with full `AssetContext` - Generates a complete Node.js bundle (runtime + chunks + entry) for the imported module - Tracks file dependencies for proper cache invalidation **`SourceTransform` trait (`turbopack-core/src/source_transform.rs`):** - Added `asset_context` parameter to `SourceTransform::transform()` so transforms can access the full asset context for module resolution and bundling - Updated all implementors: `JsonSourceTransform`, `TextSourceTransform`, `BytesSourceTransform`, `MdxTransform`, `PostCssTransform`, `WebpackLoaderItems` **Node.js runtime (`turbopack-node/js/src/transforms/`):** - `webpack-loaders.ts`: Implements `this.importModule()` on the loader context, sends IPC request and evaluates the returned bundle - `webpack-loaders-runtime.ts`: In-memory CJS module evaluator that loads bundle chunks using `vm.compileFunction`, with support for: - Relative and absolute path resolution within the bundle - External package delegation to real Node.js `require()` - Patched `fs.createReadStream` for in-memory WebAssembly binary assets **New `ImportModule` reference subtype (`turbopack-core/src/reference_type.rs`):** - Added `EcmaScriptModulesReferenceSubType::ImportModule` to mark references created by importModule for proper handling in the module graph ### Test Coverage Comprehensive e2e test (`test/e2e/app-dir/webpack-loader-import-module/`) covering: - **TypeScript modules** with CJS and ESM dependencies - **CJS dependency chains** (TS → CJS → JSON) - **ESM `.mjs` modules** with shared dependencies - **Resolve aliases** (`alias-data` → `alias-data.mjs` via `resolveAlias` config) - **Custom loader rules** (`.custom-data` files processed by `text-to-export-loader`) - **Transitive dependencies** through aliases and custom loaders - **Turbopack-only features**: `new URL()` asset references, WebAssembly imports (`add.wasm`), and dynamic `import()` within importModule targets All tests pass for both webpack and Turbopack modes. --------- Co-authored-by:
Claude <noreply@anthropic.com> Co-authored-by:
Tobias Koppers <sokra@users.noreply.github.com>
-
Tobias Koppers authored
### What? Batch the scheduling of dirty tasks during aggregation update processing instead of scheduling them one at a time. In `aggregation_update.rs`, `find_and_schedule_dirty_internal` previously called `ctx.schedule()` immediately for each task it decided to schedule. This involved a separate `ctx.task(id, TaskDataCategory::All)` call per task to read `leaf_distance` and `has_output` before calling `turbo_tasks.schedule(id, priority)`. ### Why? Each individual `ctx.task(...)` call may require restoring task data from persistent storage (disk I/O). When many tasks need scheduling — e.g. during a large invalidation wave, or initially when all session-dependent tasks are scheduled — doing this one-at-a-time is inefficient. `for_each_task_all` (via `prepare_tasks_with_callback`) can batch the restoration of persistent task data, amortizing I/O overhead across all tasks in the batch. ### How? - Added a `scheduled_tasks: FxHashMap<TaskId, TaskPriority>` field to `AggregationUpdateQueue` (skipped in bincode serialization — transient state that doesn't survive suspend/resume). - `find_and_schedule_dirty_internal` now inserts `(task_id, parent_priority)` into `scheduled_tasks` instead of calling `ctx.schedule()` directly. - At the end of `process()` (in the final `else` branch, when all sub-queues are exhausted), if `scheduled_tasks` is non-empty, `ctx.for_each_task_all` is called to batch-fetch the tasks and schedule them, then `scheduled_tasks` is cleared. This maximizes batch size by deferring all scheduling to the end of the operation. - `scheduled_tasks` is included in `is_empty()` (with exhaustive struct destructuring) so the compiler enforces the check stays up to date. --------- Co-authored-by:
Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by:
Claude <noreply@anthropic.com>
-
Tobias Koppers authored
### What? Skip the `loadBindings()` call that checks Lightning CSS support when `loadConfig()` is called during `PHASE_PRODUCTION_SERVER` (`next start`). ### Why? `loadConfig()` currently calls `loadBindings()` (which loads the native SWC `.node` binary) whenever `experimental.useLightningcss: true` is set, in order to check whether the binary supports Lightning CSS. This check gates a warning and a flag reset. During `next start`, the app is already fully built — no CSS compilation happens at serve time. Loading the native binary purely to run a capability check that has no effect is wasted work, and it delays server startup unnecessarily. ### How? - Promote `PHASE_PRODUCTION_SERVER` from a type-only import to a value import in `config.ts` so it can be used in a runtime comparison. - Add `phase !== PHASE_PRODUCTION_SERVER &&` as the first condition of the `if` block that calls `loadBindings()` for the Lightning CSS check. When the phase is `PHASE_PRODUCTION_SERVER`, the block is skipped entirely and `useLightningcss` is left as-is (unchanged). All other phases (`PHASE_DEVELOPMENT_SERVER`, `PHASE_PRODUCTION_BUILD`, `PHASE_EXPORT`, etc.) are unaffected — `loadBindings()` is still called and the capability check runs as before. Co-authored-by:
Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by:
Claude <noreply@anthropic.com>
-
Tobias Koppers authored
### What? In `turbopack/crates/turbopack-core/src/module_graph/mod.rs`, the `#[cfg(debug_assertions)]` duplicate module ident detection block inside `SingleModuleGraph::new_inner` called `panic!` when duplicates were found. ### Why? `panic!` terminates the process hard, bypassing the normal error-handling chain. The enclosing function `new_inner` already returns `anyhow::Result<Vc<Self>>`, and `bail!` is already imported and used elsewhere in the same file. Using `bail!` converts this into a propagatable error, consistent with the rest of the error-handling idioms in the module. ### How? Single-line change: replace `panic!(...)` with `bail!(...)` at the duplicate module detection site. No new imports needed — `bail!` was already in scope via `use anyhow::{Context, Result, bail};`. Co-authored-by:Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by:
Claude <noreply@anthropic.com>
-
Tobias Koppers authored
### What? Migrates the `.claude/commands/pr-status.md` slash command into the `.agents/skills/pr-status-triage/` skill, restructuring the files so that `SKILL.md` has a single unified workflow and supporting details live in the appropriate reference files. Deletes the original command file. ### Why? The pr-status automated workflow existed in two places: a basic 6-step outline in `SKILL.md` and a detailed 10-step procedure in `.claude/commands/pr-status.md`. This duplication meant the skill was incomplete without the command file, and the command file couldn't benefit from the skill's supporting reference files (`workflow.md`, `local-repro.md`). ### How? **`SKILL.md`** — Replaced the old 6-step overview with a unified 7-step workflow covering: background `--wait` script launch, failure/review analysis, blocker-first prioritization, flaky test checking, local reproduction, resolving review threads, and retriggering CI when only flaky tests remain. Step 7 now includes a retry loop: after retriggering, wait 5 minutes and re-triage from step 1, up to 5 times. **`workflow.md`** — Extended with content from the command file: subagent prompt templates (CI failures + review comments), summary table format examples, failure category taxonomy (8 categories), and review comment category taxonomy (7 types). Existing sections (prioritization order, failure handling rules, common patterns, resolving review threads) preserved. **`local-repro.md`** — Expanded the "Match CI Environment Variables" section with feature flag details (`__NEXT_USE_NODE_STREAMS`, `__NEXT_CACHE_COMPONENTS`), the `NEXT_SKIP_ISOLATE` warning for module resolution fixes, and a concrete example command. **`AGENTS.md`** — Updated the stale `/pr-status` command reference to point to the `$pr-status-triage` skill. **`.claude/commands/pr-status.md`** — Deleted (all content migrated). ### Files changed | File | Action | |------|--------| | `.agents/skills/pr-status-triage/SKILL.md` | Rewritten with unified workflow (includes retry loop for flaky CI) | | `.agents/skills/pr-status-triage/workflow.md` | Extended with templates, tables, categories | | `.agents/skills/pr-status-triage/local-repro.md` | Expanded env var section | | `AGENTS.md` | Updated skill reference (1 line) | | `.claude/commands/pr-status.md` | Deleted | --------- Co-authored-by:
Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by:
Claude <noreply@anthropic.com>
-
Tobias Koppers authored
### What? Batch-process `find_and_schedule_dirty` in `aggregation_update.rs` by collecting all queued jobs (up to `FIND_AND_SCHEDULE_BATCH_SIZE` = 10 000) into a `SmallVec` and pre-fetching their task metadata with a batched `ctx.for_each_task_meta(...)` call. ### Why? `find_and_schedule` can accumulate thousands of tasks during invalidation cascades. The previous implementation issued one `ctx.task(...)` call per task inside `process()`, serializing backing-storage fetches one at a time. `ctx.for_each_task_meta` triggers a batched fetch of all task metadata from the backing store: keys are sorted by hash for cache-friendly sequential access to the storage layer. The callback is invoked per-task once data is ready, with the task guard handed directly to the callback — no second lock acquisition needed. The batch limit is set to 10 000, because find-and-schedule jobs are cheap (metadata read + optional schedule) compared to aggregation-update jobs, so yielding less often is safe and beneficial. ### How? **`fn process` — `find_and_schedule` branch:** - Replace the one-at-a-time loop with a single `drain(..FIND_AND_SCHEDULE_BATCH_SIZE)` that collects up to 10 000 `FindAndScheduleJob` structs into a `SmallVec`, then calls `find_and_schedule_dirty` once with the whole batch. **`fn find_and_schedule_dirty`:** - Change parameter from `task_id: TaskId` to `jobs: SmallVec<[FindAndScheduleJob; 4]>`. - Call `ctx.for_each_task_meta(...)` to batch-prefetch all task metadata (sorted by hash for cache-friendly access) and process each task in the callback. **`prepare_tasks_with_callback` fix:** - Release `TaskLockCounter` *before* calling `prepared_task_callback` instead of after. This ensures the counter is 0 when the callback runs, so callbacks that drop their task guard and then call `ctx.task()` (like `find_and_schedule_dirty_internal` → `ctx.schedule()`) no longer trigger the "Concurrent task lock acquisition detected" panic in debug builds. - `for_each_task` now uses `acquire()` instead of `reacquire()` since counter is guaranteed 0 at callback entry. `reacquire()` is removed. **Cleanup:** - Use `FxHashMap` (already imported) instead of `std::collections::HashMap`. - Combine consecutive `#[cfg(trace_find_and_schedule)]` let bindings for clarity. - Add `FIND_AND_SCHEDULE_BATCH_SIZE = 10_000` as a self-contained constant (not derived from `MAX_COUNT_BEFORE_YIELD`). --------- Co-authored-by:
Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by:
Claude <noreply@anthropic.com>
-
Will Binns-Smith authored
App router handlers are already built with the Turbopack runtime, so they can use server HMR. **We also already get subscription events for their chunks.** However, unlike app pages which use `__next_app__.require()` for dynamic devModuleCache lookup, route handlers capture userland exports statically in AppRouteRouteModule at construction time. This change makes routes behave a lot like pages, dynamically loading the user's code when requests are made. This way, we can freely invalidate and reload it when changes are made without evicting the entire require cache. Only `next dev` uses this lazy evaluation, as `next start` continues to eagerly import route handlers. This change removes the `isAppPage` restriction from `usesServerHmr`, extending server HMR coverage to all App Router entries (pages and route handlers) built with the Node.js runtime. For route handlers, we also clear the entry chunk from Node.js `require.cache` on each rebuild so the next `requirePage()` call re-executes the entry and obtains fresh module exports from `devModuleCache` (which HMR updates in-place). Test Plan: Added an additional e2e test, `with-dep`
-
- 18 Mar, 2026 14 commits
-
-
Luke Sandberg authored
## Summary - **Use `modified` flags instead of `restored` flags** to decide which task data categories to encode during snapshots. Previously, `process` used `restored` flags (encoding any category that had been loaded into memory), while `process_snapshot` used `modified` flags. The `restored` check was overly conservative — it would re-serialize categories that were loaded from disk but never actually changed. Using `modified` for both paths only encodes categories that were actually dirtied, avoiding redundant re-persistence of clean data. - **Unify `process` and `process_snapshot` into a single callback** on `take_snapshot`. Since both closures now use the same logic (`modified` flags), the two-callback API was unnecessary. `take_snapshot` now takes a single `Fn(TaskId, &TaskStorage, &mut TurboBincodeBuffer) -> SnapshotItem` — for snapshot copies the `Box<TaskStorage>` is simply dereferenced before calling. - **Change transient task handling from silent empty return to `unreachable!`**, since transient tasks should never appear in the persistence path. ## Test plan - Existing snapshot/persistence tests should continue to pass - The `modified` flags are always set for any task that ends up in the modified map (via `track_modification_internal`), so no categories are missed
-
nextjs-bot authored
-
Luke Sandberg authored
## Summary Update the workspace `tokio` dependency from 1.43.0 to ~1.47.3 (pinned to the 1.47.x LTS minor line). The tokio 1.43.x LTS line expires **March 2026**. This moves to the 1.47.x LTS line (supported until September 2026). The tilde version specifier (`~1.47.3`) ensures we stay on the 1.47.x minor version and only pick up patch releases (e.g. 1.47.4), not new minor versions. ### Key changes included in this bump - **Soundness fix**: broadcast channel clone race condition (1.44.2) - **`select!` is now budget-aware** (1.44) — cooperates with tokio's cooperative scheduling - **Stabilized runtime metrics**: `worker_total_busy_duration`, `worker_park_count`, `worker_unpark_count` (1.45) - **Performance**: improved `AtomicWaker::wake`, eliminated unnecessary `lfence` in task queue (1.46-1.47) - **New APIs**: `sync::SetOnce`, `Notify::notified_owned()`, `broadcast::WeakSender`, `biased` option for `join!`/`try_join!` - **`runtime::Handle` marked unwind-safe** (1.45) - Transitive dep bump: `socket2` 0.5 → 0.6, `windows-sys` 0.52 → 0.61 ### Breaking changes (verified safe) - `from_std` now panics on blocking sockets — **no `TcpStream::from_std` calls in codebase** - `LocalSet::{poll,drop}` disallows blocking — **no `LocalSet` usage in codebase** - `select!` budget awareness — behavioral change, should improve fairness ### New duplicate dependencies - `socket2 v0.6.2` added (v0.4 and v0.5 already existed due to `hyper 0.14`) ## Test plan - [x] `cargo check` passes with no errors - [ ] CI build and test suite -
Jiwon Choi authored
## Summary - Add `.claude/skills` symlink pointing to `.agents/skills` for skill discovery
-
Henry authored
## What Removes the `Buffer.from()` wrapper when constructing `RenderResult` for `/_next/data/` JSON responses in the Pages Router handler. ## Why PR #80189 introduced `Buffer.from(JSON.stringify(result.value.pageData))` when building the data response. Since `RenderResult.isDynamic` checks `typeof this.response !== 'string'`, passing a `Buffer` (not a `string`) caused it to return `true`, making `sendRenderResult` treat the response as a dynamic stream — skipping `Content-Length` and `ETag` generation and falling back to `Transfer-Encoding: chunked`. This is a regression from v15.4.0 and breaks CDN-side compression for self-hosted deployments (e.g. CloudFront requires `Content-Length` to compress origin responses on-the-fly). ## Fix ```diff - Buffer.from(JSON.stringify(result.value.pageData)), + JSON.stringify(result.value.pageData), ``` ## Testing - Reproduction steps verified against the reporter's repro repo: https://github.com/bbrouse/nextjs-content-length-repro - ```diffcurl -sD - on /_next/data/<BUILD_ID>/index.json``` now returns Content-Length and ETag headers. ## Affected Area - Pages Router — /_next/data/ responses only - No impact on App Router - Single-line change, minimal blast radius Fixes #90281 --------- Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
nextjs-bot authored
-
JJ Kasper authored
## Summary - normalize encoded dynamic placeholders like `%5Bproject%5D` before parsing app route segments - add a fallback params regression test covering encoded placeholder inputs - assert vary-param segment prefetch responses do not contain encoded root param placeholders ## Testing - pnpm testheadless packages/next/src/server/request/fallback-params.test.ts - pnpm testheadless test/e2e/app-dir/segment-cache/vary-params/vary-params.test.ts -t "tracks root param access via rootParams API"
-
Zack Tanner authored
In a deployed environment, `onCacheEntryV2` determines whether a postponed response is HTML-origin or RSC-origin by checking whether meta.url ends with `.rsc`. For some dynamic full-route RSC requests, Next was passing a URL with query params into onCacheEntry, for example: `/[tenant]/samples.rsc?nxtPtenant=tenant-x` Because that string does not end with .rsc, `onCacheEntryV2` misclassified the request as HTML and treated it as text/html instead of an RSC response. This PR normalizes the URL before passing it to `onCacheEntry`, so the callback receives the pathname rather than the full URL-with-query. --------- Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
Denes Beck authored
Co-authored-by:Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
-
nextjs-bot authored
-
Hendrik Liebau authored
[Flakiness metrics](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.status%3A%22fail%22%20%40test.name%3A%22basePath%20should%20use%20urls%20with%20basepath%20in%20router%20events%20for%20hash%20changes%22&agg_m=count&agg_m_source=base&agg_t=count¤tTab=overview&eventStack=&fromUser=false&index=citest&start=1773244604685&end=1773849404685&paused=false) After upgrading Playwright in #91250 (which brought some performance improvements), some tests are now exposed to be missing retries around assertions. `test/e2e/basepath/router-events.test.ts` is one of those tests, and this PR adds a `retry` around the event log assertion. We're also replacing the deprecated `check` utility with `retry` when waiting for the router to be ready.
-
Joseph authored
Just a complementary note to the TS config reference.
-
nextjs-bot authored
-
Richard Zhang authored
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> Updates the Subresource Integrity (SRI) documentation to reflect that the feature is now supported on both Webpack and Turbopack bundlers. Previously, the documentation stated that SRI was "only available with webpack bundler". This has been updated to remove that restriction following the implementation in PR #90152. ### Changes - Removed webpack-only limitation from SRI documentation in Content Security Policy guide - Removed `experimental.sri.algorithm` from the list of unplanned Turbopack features Fixes the documentation to align with the current implementation. <!-- CURSOR_AGENT_PR_BODY_END --> [Slack Thread](https://vercel.slack.com/archives/D0AGHCN7K2T/p1771984911390169?thread_ts=1771984911.390169&cid=D0AGHCN7K2T) <div><a href="https://cursor.com/agents/bc-0b4d6ed8-9e06-5c78-9a4d-b352a7c2e97d"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-0b4d6ed8-9e06-5c78-9a4d-b352a7c2e97d"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> --------- Co-authored-by:
Cursor Agent <cursoragent@cursor.com> Co-authored-by:
Richard Zhang <richardjzhang@users.noreply.github.com> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-