- 28 Feb, 2026 9 commits
-
-
nextjs-bot authored
-
JJ Kasper authored
## Summary - Adds `cleanupScriptPath` workflow dispatch input and `NEXT_TEST_CLEANUP_SCRIPT_PATH` env var to `test_e2e_deploy_release.yml` (webpack + turbopack jobs) - Adds `cleanupUsingCustomScript()` method to `NextDeployInstance` following the same pattern as the existing deploy and logs scripts - Calls the cleanup script in `destroy()` before existing teardown logic --------- Co-authored-by:Vercel <vercel[bot]@users.noreply.github.com>
-
Benjamin Woodruff authored
We're getting crashes in node: https://github.com/vercel/workflow/actions/runs/22500511618/job/65186125774#step:10:224 It looks like this should be fixed in newer versions of node: - https://github.com/napi-rs/napi-rs/issues/2555#issuecomment-3645173223 - https://github.com/nodejs/node/pull/55877 - https://github.com/nodejs/node/pull/61400 - https://github.com/nodejs/node/pull/61661 So we may enable the worker threads feature by default if we detect a new enough version of node or bun.
-
Benjamin Woodruff authored
Turbopack: Allow turbopack-node backend to be swapped at runtime using an experimental config option (#90671) <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> Follow-up to https://github.com/vercel/next.js/pull/86266 This was mostly LLM-generated, but it's just moving things around and threading through a config option. We'd like to be able to turn this on/off with an experimental config option: \- Fixes issues where RA thinks a bunch of code is dead. \- Lets us isolate potential issues to the worker thread implementation. \- Provides an escape hatch for users in case there are issues. \- Better fits the cargo "additive feature" model.
-
Luke Sandberg authored
### What? Replace the two-pass SST file write approach with a single-pass `StreamingSstWriter` that writes blocks incrementally as entries arrive. Also replace the compaction `Collector`'s double-buffered `last_entries` pattern with a streaming collector that wraps the new writer. ### Why? The previous SST write path materialized all entries in memory (keys + values), then wrote all value blocks, then all key blocks. During compaction, the `Collector` maintained two full entry vectors (`entries` + `last_entries`) for size balancing. For large SST files (256MB+), this required holding hundreds of MB of entry data in memory simultaneously. The streaming approach reduces peak memory per writer from hundreds of MB to ~200KB by writing blocks to disk as soon as possible rather than buffering everything. ### How? **Phase 1: `StreamingSstWriter` in `static_sorted_file_builder.rs`** The key insight is that the SST reader is **block-index-addressed** — it locates blocks by index via the offset table, not by file position. So interleaving value blocks and key blocks in any order is fully compatible with the reader. The writer processes entries one at a time: - **Medium values** are written to disk immediately as individual blocks - **Small values** accumulate in a buffer and flush when reaching 8KB - **Key blocks** flush incrementally as the resolved boundary advances A `VecDeque<PendingKeyEntry>` holds entries waiting for their value blocks to be written. Each pending entry contains a `ValueRef` that tracks where its value lives: - `Small { block_index, offset, size }` — already resolved - `PendingSmall { small_block_id, offset, size }` — waiting for small block flush - `Medium { block_index }` — already resolved (written immediately) - `Inline`, `Blob`, `Deleted` — no value block needed The `first_pending_small_index` partitions `pending_keys` into resolved entries (front) and unresolved entries (back). Key blocks are flushed **incrementally** via `try_flush_key_blocks()` at the two points where this boundary advances: - When a small value block is flushed — resolves all `PendingSmall` entries, then calls `try_flush_key_blocks()` to flush any complete key blocks from the resolved region - In `advance_boundary_to()` — processes resolved entries and flushes key blocks via `try_flush_key_block()` when they exceed size or entry count limits This makes adding N entries **O(N) total** instead of O(N²) from the earlier per-call scan approach. **Key block flushing**: The `try_flush_key_block()` method combines the check-and-flush logic — it tests whether adding the next entry would exceed `MAX_KEY_BLOCK_SIZE` (16KB) or `MAX_KEY_BLOCK_ENTRIES`, and if so, flushes the accumulated key block. Entries sharing the same key hash are never split across blocks. **AMQF filter**: Created with `max_entry_count` (an upper bound), then shrunk via `shrink_to_fit()` on `close()` to reclaim unused capacity while preserving false positive rates. **Index block writing**: `IndexBlockBuilder` is generic over `Write` and writes directly to the `BufWriter` during `close()`, avoiding an intermediate buffer allocation. Index blocks use `write_raw_block_to_file` since they are never compressed. **File size**: Computed from the last block offset plus the offset table size, avoiding a `stream_position()` call (which would trigger an unnecessary flush + seek syscall). `write_static_stored_file()` is reimplemented as a thin wrapper around `StreamingSstWriter`, so existing callers (`write_batch.rs`, benchmarks) need zero changes. **Phase 2: Streaming compaction in `db.rs`** The compaction `Collector` is simplified to wrap an `Option<(u32, StreamingSstWriter)>`. The old pattern of maintaining `entries` + `last_entries` vectors with swap/early-flush/split logic (~100 lines) is replaced by direct calls to `writer.add()`. The collector tracks total key/value sizes and a `ValueBlockCountTracker` to know when to finish the current writer and start a new one. **Memory savings:** | | Previous (compaction) | Streaming | |---|---|---| | Entry storage | `entries` + `last_entries` (up to 2× full entry vecs) | ~800 pending key entries (~80KB) | | Value data | All values held in memory until written | Written immediately (medium) or after 8KB (small) | | Peak for 256MB SST | Hundreds of MB | ~200KB per writer | **Performance** Both compaction and write benchmarks are within the noise. It makes sense that this might be slightly slower due to some additional per-entry work, but writing is dominated by other factors `write` syscalls, compression and memcopies into temporary buffers. **Files changed:** - `turbopack/crates/turbo-persistence/src/static_sorted_file_builder.rs` — `StreamingSstWriter` with incremental key block flushing via `try_flush_key_block()`, `PendingKeyEntry`, `ValueRef`; generic `IndexBlockBuilder<W: Write>`; `write_static_stored_file` as wrapper; AMQF `shrink_to_fit()` on close - `turbopack/crates/turbo-persistence/src/db.rs` — Replaced compaction `Collector` with streaming version - `turbopack/crates/turbo-persistence/src/lib.rs` — Export `StreamingSstWriter` - `turbopack/crates/turbo-persistence/src/value_block_count_tracker.rs` — Removed dead `is_half_full()`/`reset_to()` methods **Verification:** - `cargo clippy -p turbo-persistence` — zero warnings - `cargo test -p turbo-persistence` — all 46 tests pass - `cargo fmt -p turbo-persistence -- --check` — clean - Criterion benchmarks show no performance regressions (write + compaction within noise) -
nextjs-bot authored
-
Will Binns-Smith authored
App router types like routes go through the traditional `require` route bypassing the Turbopack runtime, so they aren't easily solved with server HMR right now. Test Plan: Added an e2e test. --------- Co-authored-by:vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Niklas Mischkulnig authored
Fixes this deploy test failure: https://github.com/vercel/next.js/actions/runs/22499483165/attempts/2 The output might be: ``` Building: └ ○ /nested Building: ○ (Static) prerendered as static content Building: ƒ (Dynamic) server-rendered on demand Building: > @ post-build /vercel/path0 Building: > node -e 'console.log("BUILD" + "_ID: " + fs.readFileSync(".next/BUILD_ID") + "\nDEPLOYMENT" + "_ID: " + process.env.NEXT_DEPLOYMENT_ID + "\nIMMUTABLE_ASSET" + "_TOKEN: " + process.env.VERCEL_IMMUTABLE_ASSET_TOKEN)' Building: BUILD_ID: build-TfctsWXpff2fKS Building: DEPLOYMENT_ID: dpl_5Qad8NbhCPWn7QRf5TiCePi58vVi Building: IMMUTABLE_ASSET_TOKEN: undefined Building: Build Completed in /vercel/output [15s] Building: Deploying outputs... Building: Deployment completed ``` Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
JJ Kasper authored
## Summary For context we discovered jobs were not reliably always running in https://github.com/vercel/next.js/pull/90668 as addapters + turbopack group ran more tests than just turbopack group. - Each sharded test sub-job independently fetched test timings from KV via a turbo task. Because turbo cache keys can vary across job groups and KV can return slightly different data at different times, the sharding algorithm produced different test-to-shard assignments across groups — causing some tests to be missing entirely and others to run in multiple shards. - Adds a `--require-timings` flag to `run-tests.js` that fails loudly if `test-timings.json` can't be loaded from disk, preventing silent fallback to KV or round-robin. - Adds a `testTimingsArtifact` input to `build_reusable.yml` that downloads a pre-built timings artifact instead of fetching via turbo. When unset (default), existing behavior is preserved. - In both `test_e2e_deploy_release.yml` and `build_and_test.yml`, timings are now fetched once in a setup job, uploaded as a GitHub artifact, and downloaded by all sub-jobs — guaranteeing identical shard assignments across all job groups. ## Test plan - [ ] Verify `build_and_test.yml` jobs pick up the shared `test-timings` artifact - [ ] Verify `test_e2e_deploy_release.yml` deploy jobs pick up the shared `test-timings` artifact - [ ] Verify workflows that don't pass `testTimingsArtifact` (e.g. `integration_tests_reusable.yml`, `pull_request_stats.yml`) still use the turbo fallback path unchanged
-
- 27 Feb, 2026 22 commits
-
-
nextjs-bot authored
-
JJ Kasper authored
This ensures we don't try running both webpack and turbopack suites or the report/PR jobs when a custom deploy script is provided.
-
nextjs-bot authored
-
Joseph authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? Added a new "Content negotiation" subsection to the Backend For Frontend (BFF) guide. Updated the `related` links in the frontmatter of the BFF guide to include "rewrites". ### Why? To document how to implement content negotiation using Next.js rewrites and Route Handlers, specifically for serving different content types (e.g., Markdown) based on the `Accept` header. This includes explaining the role of the `Vary: Accept` header for correct caching behavior. ### How? A new subsection was added to `docs/01-app/02-guides/backend-for-frontend.mdx`. The section includes a `next.config.js` rewrite example using `has` to match the `Accept` header. A corresponding Route Handler example (`app/docs/md/[...slug]/route.ts`) demonstrates serving Markdown content. The documentation explains the `Vary: Accept` header and its implications for caching. The `related` links in the frontmatter were updated to point to the rewrites documentation. Closes NEXT- Fixes # --> --- [Slack Thread](https://vercel.slack.com/archives/C07BS1WEYAZ/p1772118031912479?thread_ts=1772118031.912479&cid=C07BS1WEYAZ) <p><a href="https://cursor.com/agents/bc-2c93f44d-958d-5c0b-abe0-a2b36aa76f19"><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-2c93f44d-958d-5c0b-abe0-a2b36aa76f19"><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> </p> --------- Co-authored-by:
Cursor Agent <cursoragent@cursor.com> Co-authored-by:
Joseph <icyJoseph@users.noreply.github.com> Co-authored-by:
vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Janka Uryga authored
The `runInContext` pattern that's used all over `stream-ops` is weird and feels very unnecessary -- we're passing in callbacks that just get invoked immediately, and all they do is call `AsyncLocalStorage.run`. We should just use the standard `AsyncLocalStorage.run` method outside instead. I commented about getting rid of it somewhere on the original node streams PR, but that got lost when it was was split up. I believe the original reasoning for addding it at all was that some of the node-streams implementations needed to preserve async context for callbacks -- see eg [here](https://github.com/vercel/next.js/blob/558f4248e5e5641d78b865a291c099791460d486/packages/next/src/server/app-render/node-stream-tee.ts#L244). But if that's the motivation, then the current `runInContext` pattern **is wrong anyway** -- sure, it preserves `workUnitAsyncStorage`, but doesn't preserve `workAsyncStorage` and whetever other ALSes may be present, so it's not semantically correct. If this is the goal, then the relevant callbacks should use `bindSnapshot` (i.e. `AsyncLocalStorage.bind`) instead, because it preserves the entire context, not just one ALS. (Note that technically the `runInContext` pattern is salvageable if we just always pass `AsyncLocalStorage.snapshot()`, but then i see no reason why the caller should have to do that. `AsyncLocalStorage.bind` is cleaner) Note that this'll require changes in #89859
-
Joseph authored
- Remove BuildKit cache mount on `.next/cache` that trapped fetch cache in a volume unreachable by the runner stage - Restore `mkdir .next && chown` in runner stage for writable prerender cache - Add commented-out `COPY .next/cache` line as opt-in for persisting build-time fetch cache - Apply same fixes to `Dockerfile.bun` (only needed the `mkdir`/`chown`, it never had the BuildKit mount) Closes #90648
-
Mimori authored
## For Contributors ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### What? Fix two bugs in the `useReportWebVitals` API reference docs: 1. `navigationType` value `"back_forward"` → `"back-forward"`: the `web-vitals` library intentionally renames this value to use a hyphen for consistency. 2. Variable name mismatch in `handleCustomMetrics` example: parameter was named `metrics` (plural) but the function body referenced `metric.name` (singular), causing a `ReferenceError`. ### Why? The `navigationType` description reflected the raw `PerformanceNavigationTiming` API value (`"back_forward"`), not the actual value emitted by the `web-vitals` library (`"back-forward"`), which `useReportWebVitals` is built on top of Ref: https://github.com/GoogleChrome/web-vitals?tab=readme-ov-file#types The variable name mismatch in the code example would cause a `ReferenceError` if copied as-is. ### How? - Updated `navigationType` description to use `"back-forward"`. - Renamed parameter `metrics` → `metric` in the `handleCustomMetrics` example --------- Co-authored-by:
Joseph <sephxd1234@gmail.com> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Sebastian "Sebbie" Silbermann authored
-
agneliutkiene authored
This proposal adds Hostinger Web Apps Hosting as one additional deployment option in existing deployment documentation. - Keeps language provider-neutral - No runtime or code behavior changes - Keeps current structure and recommendations intact Link used: https://github.com/hostinger/deploy-nextjs --------- Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Niklas Mischkulnig authored
This allows specifying a different deployment id for static immutable assets - [x] rename `getImmutableAssetToken` to `getAssetToken` (because it can be non-immutable as well) - [x] disable for webpack Closes PACK-6534 For https://github.com/nextjs/adapter-vercel/pull/25 Part of PACK-6802
-
Tobias Koppers authored
### What? Adds periodic process memory sampling to the Turbopack trace system. Two new capabilities: 1. **`TraceRow::MemorySample`** — A new trace row variant that captures `TurboMalloc::memory_usage()` at ~10ms intervals 2. **`memory_samples`** **in** **`QueryResult`** — When querying a span, returns up to 200 memory usage samples covering the span's time range ### Why? To provide visibility into process memory usage over time in the Turbopack trace viewer. Currently the trace system tracks per-span allocations/deallocations but has no global memory usage timeline. ### How? **Sampling (`turbopack-trace-utils`):** - New `TraceRow::MemorySample { ts, memory }` variant - Sampling triggered from `on_enter` using a three-tier dedup strategy to minimize overhead: 1. Thread-local check (no synchronization) 2. Global atomic read (single load) 3. CAS to claim the sample (only one thread wins per interval) - This ensures at most one sample per 10ms across all threads **Storage (`turbopack-trace-server`):** - Global sorted `Vec<(Timestamp, u64)>` in the `Store` - Insertion-sort step on add (efficient since samples arrive nearly sorted) - Binary search for range queries **Query (`turbopack-trace-server`):** - `memory_samples_for_range(start, end)` returns up to 200 samples - When more exist, merges groups of N by taking the max value per group - Added `memory_samples: Vec<u64>` field to `QueryResult` https://github.com/vercel/turbo-trace-viewer/pull/24 -
Niklas Mischkulnig authored
Disabled for now Expose a hash for each file that should be treated as immutable For https://github.com/nextjs/adapter-vercel/pull/25 Part of PACK-6802
-
Sebastian "Sebbie" Silbermann authored
Instead of just limiting the transform to any file within the app dir, we now restrict it to any page, default, or layout file in the app dir. This avoids having the transform applied to random modules. The inserted value would not have been used by anything.
-
Niklas Mischkulnig authored
Enable skew protection for all start-mode tests when Turbopack is enabled (i.e. not dev). This works by setting `NEXT_DEPLOYMENT_ID` in the test infra - When running the tests, `packages/next/src/server/lib/router-utils/resolve-routes.ts` now validates that all static asset requests have the correct `?dpl=...` query param value, and returns a 404 if missing. - It can be disabled with `disableAutoSkewProtection: true` in the test options - There were various tests that were asserting URLs and were missing the optional `?dpl` at the end. - `next.getDeploymentIdQuery()` can be used to get the `?dpl=dpl_123912js` string (or an empty string) - `next.getAssetQuery()` currently behaves like `getDeploymentIdQuery`, but will switch to prefer the immutable static token in #88607
-
Sebastian "Sebbie" Silbermann authored
-
Sebastian "Sebbie" Silbermann authored
-
Niklas Mischkulnig authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
xusd320 authored
1. refactor `turbopack-node` to run webpack loaders via nodejs `worker_threads` 2. the `child_proccess` loader runner is keep in the crate feature to run unit tests in `turbopack-tests` or run `turbopack-cli` 3. if wanting to switch back to `child_proccess` loader runner, change features of `turbopack_node/worker_pool` to `turbopack_node/process_pool` in crate `next-swc-napi` 4. after switched to `worker_threads` loader runner, debugging with `CDP` (spawn child_process via `--inspect-brk`) doesn't work anymore, but you can use breakpoint debugging in IDE (like vscode) directly --------- Co-authored-by:
Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Co-authored-by:
Benjamin Woodruff <benjamin.woodruff@vercel.com>
-
nextjs-bot authored
-
JJ Kasper authored
Follow-up to https://github.com/vercel/next.js/pull/90611 this fixes the middleware case to ensure it doesn't create a `_next/data` output. x-ref: https://github.com/vercel/next.js/actions/runs/22465910596/job/65075127711#step:34:302
-
Will Binns-Smith authored
Previously, we lost stack frame information when server hmr code was applied through `eval`. This adds and calls \`maybeInlineSourcemap()\` to the Turbopack Node.js HMR runtime that appends \`//# sourceURL\` and \`//# sourceMappingURL\` (base64-encoded) to each `eval`ed module entry. Test Plan: CI for #90389 -
Benjamin Woodruff authored
We've had some really bad bugs in the past, which can be hard to root-cause due to eventually-consistent reads a the top-level, e.g. https://github.com/vercel/next.js/pull/77511 Outside of tests, there's no good justification for doing an eventually-consistent read at the top level. It may leak incomplete computations, which can contain errors that would otherwise be resolved by a strongly consistent read. The basic idea here is simple: - Store a flag in `CURRENT_TASK_STATE` indicating that we're in a top-level task. - When reading a task output or cell, check for that flag. But, there are a few complications: - `RawVc`'s read and resolution logic is wrong, and internally uses multiple eventually consistent operations after a strongly consistent read. - For this to be correct, it needs to happen as one atomic operation inside of the task backend, but it would change the backend API contract, so it's not straightforward to do that. - I added a `SUPPRESS_EVENTUAL_CONSISTENCY_TOP_LEVEL_TASK_CHECK` flag that I'm using for now. - There are a ton of places that are doing eventually consistent reads for no good reason. These aren't causing problems today, but we should fix them instead of suppressing them. Claude helped with this, but it's still a lot. - Some tests actually do need eventually-consistent reads because they're testing some internal behavior of turbo-tasks. I added an intentionally long-named `unmark_top_level_task_may_leak_eventually_consistent_state` helper for this. I manually tested `turbopack-cli` against our bundler-benchmark repository that uses it.
-
- 26 Feb, 2026 9 commits
-
-
nextjs-bot authored
-
Will Binns-Smith authored
This implements the `restart` event, fully evicting all caches. This is needed for when client manifest changes are made. Test Plan: CI for https://github.com/vercel/next.js/pull/90389
-
Andrew Imm authored
When cold-booting `next dev` on a fresh create-next-app, on the first server hit we need to fetch fonts and compile CSS, which takes up nearly half of the request time. It shouldn't be necessary to wait until the first server request to launch the first NodeJS process (eventually used for PostCSS processing in Tailwind). Once the server has started, we can anticipate that first request and pre-warm a single Node process. Because we grab the boot semaphore, if a request comes in as soon as the server is ready, it waits on the semaphore to resolve, and at most it takes as long as it would before this change. In all likelihood, the Node process is ready before any server request comes in. It also slightly saves time on `next build` I'd appreciate scrutiny of all the ways this can go wrong.
-
JJ Kasper authored
Fixes failing assertion with turbopack Verified against turbopack + adapter deploy test locally <img width="2076" height="1336" alt="CleanShot 2026-02-26 at 13 25 30@2x" src="https://github.com/user-attachments/assets/a8c66314-8163-4371-b02a-dc7146989425" /> x-ref: https://github.com/vercel/next.js/pull/90600#issuecomment-3968044160
-
nextjs-bot authored
-
Luke Sandberg authored
## Summary - Remove the zstd key compression dictionary from SST files, simplifying the on-disk format - Key blocks now use plain LZ4 compression (same as value blocks), eliminating the zstd dependency - Update the turbo-persistence README to reflect the format changes ## Why The key compression dictionary added complexity (zstd dependency, dictionary computation, dual decompression paths) with diminishing returns. Plain LZ4 is already used for value blocks and provides sufficient compression for key blocks. This simplifies both the SST file format and the compaction/inspection tooling. This main goal is to unblock streaming SST writes. ## What Changed **On-disk format (breaking):** - SST files no longer start with a serialized key compression dictionary - Meta file entries no longer include the `key_compression_dictionary_length` field **Code:** - Removed `zstd` dependency from `turbo-persistence` - Removed dictionary computation in `StaticSortedFileBuilder` - Simplified `sst_inspect` tool (no more dictionary-aware decompression) - Removed `key_compression_dictionary_length` from `StaticSortedFileMetaData`, `MetaEntry`, and `MetaFileBuilder` **Docs:** - Updated README meta file format (removed dictionary length field) - Updated README SST file format (removed dictionary region) - Updated compression description to reference LZ4 directly ## Test Plan - Existing turbo-persistence tests and benchmarks pass with the format changes - `sst_inspect` tool updated to work without dictionary logic --------- Co-authored-by:Tobias Koppers <tobias.koppers@googlemail.com>
-
Jiwon Choi authored
Extends the error components API to give better control over recovery. Previously, the `reset()` prop only cleared the error state and re-rendered the children. However, this only handles a temporary rendering error. The error can be due to data fetching or an RSC phase. In these cases, `reset()` alone is not sufficient. Users would even need to implement retry logic using `router.refresh()`. Therefore, this PR adds a new `unstable_retry()` prop that calls `router.refresh()` and `reset()` within a `startTransition()` to provide built-in retry logic. This feature is expected to be preferred over the `reset()` prop. Only the cases where you'd choose `reset()` are when you have a reason to do a sync reset without loading any new data. Closes NAR-767
-
Hendrik Liebau authored
The `S` field in the RSC payload was only set to `true` during static generation, but the client used it to determine whether a route supports per-segment prefetching (`isPPREnabled` on the route cache entry). For partially static pages with Cache Components enabled, the initial HTML is served via PPR resume, which generates the RSC payload at request time with `isStaticGeneration` set to `false`. This caused `S` to be `false` even though the route fully supports per-segment prefetching. This caused the prefetch scheduler to fall back to the `LoadingBoundary` fetch strategy instead of `PPR`, which skipped fetching `_head.segment.rsc` and instead sent a `metadata-only` dynamic request. That request returned a 404 locally (harmless) but a 200 with an empty body on Vercel, which interfered with same-page navigation refreshes introduced in #76223 and exposed by the route cache keying fix in #90400. To fix this, `S` is now also set to `true` when `cacheComponents` is enabled, since all Cache Components routes support per-segment prefetching. When Cache Components is disabled, `S` continues to rely solely on `isStaticGeneration`, which is correct because fully static pages always have both their RSC payload and per-segment prefetch responses generated at build time. This PR also renames `isPPREnabled` to `supportsPerSegmentPrefetching` on the client and updates the `S` field comments in the RSC payload types to better reflect the field's actual meaning.
-
Jiwon Choi authored
User's `global-error.js` is within the router. There's no reason it shouldn't have access to the options available to the `error.js` component. It was already available on prod. This PR syncs dev behavior to prod. For the follow-up feature, `retry()` will also be available in `global-error.js`. --------- Co-authored-by:vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-