1. 23 Jan, 2026 12 commits
  2. 22 Jan, 2026 24 commits
    • Jiachi Liu's avatar
      remove gt workflow from agents.md (#88918) · d1616083
      Jiachi Liu authored
      d1616083
    • nextjs-bot's avatar
      v16.2.0-canary.4 · af10864a
      nextjs-bot authored
      af10864a
    • Brooke's avatar
      [prebuilt-skew-protection] feat: adding in automatic deploymentId (#88496) · 7282ce67
      Brooke authored
      Original [PR](https://github.com/vercel/next.js/pull/88012/) has a bug
      that attempted to validate on environment variables. Edited function to
      not run validations on environment variables, only on the user provided
      deployment id.
      
      <!-- 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: 's avatarvercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
      7282ce67
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • nextjs-bot's avatar
      v16.2.0-canary.3 · 0c196049
      nextjs-bot authored
      0c196049
    • Wyatt Johnson's avatar
      feat: implement LRU cache with invocation ID scoping for minimal mode response cache (#88509) · 092458fd
      Wyatt Johnson authored
      ## Summary
      
      Implements an LRU cache with compound keys for the minimal mode response
      cache to improve cache hit rates during parallel revalidation scenarios.
      
      **Problem**: The previous single-entry cache (`previousCacheItem`) keyed
      by pathname caused cache collisions when multiple concurrent invocations
      (e.g., during ISR revalidation) accessed the same pathname. Each
      invocation would overwrite the previous entry, leading to cache misses
      and redundant work.
      
      **Solution**: An LRU cache using compound keys (`pathname +
      invocationID`) that allows multiple invocations to cache entries for the
      same pathname independently:
      
      ```
      Cache Key Structure
      ─────────────────────
      /blog/post-1\0inv-abc  →  {entry, expiresAt}
      /blog/post-1\0inv-def  →  {entry, expiresAt}
      /blog/post-1\0__ttl__  →  {entry, expiresAt}  (TTL fallback)
      /api/data\0inv-ghi     →  {entry, expiresAt}
      ```
      
      ### Cache Key Strategy
      
      - **With `x-invocation-id` header**: Entries are keyed by invocation ID
      for exact-match lookups (always a cache hit if the entry exists)
      - **Without header (TTL fallback)**: Entries use a `__ttl__` sentinel
      key and validate via expiration timestamp
      
      ### Configuration via Environment Variables
      
      Cache sizing can be tuned via environment variables (using
      `NEXT_PRIVATE_*` prefix for infrastructure-level settings):
      
      | Environment Variable | Default | Description |
      |---------------------|---------|-------------|
      | `NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE` | 150 | Max entries in the LRU
      cache |
      | `NEXT_PRIVATE_RESPONSE_CACHE_TTL` | 10000 | TTL in ms for cache
      entries (fallback validation) |
      
      ### LRU Cache Enhancement
      
      Added an optional `onEvict` callback to `LRUCache` that fires when
      entries are evicted due to capacity limits. This enables tracking
      evicted invocation IDs for warning detection without introducing
      timer-based cleanup.
      
      ### Eviction Warnings
      
      When a cache entry is evicted and later accessed by the same invocation,
      a warning is logged suggesting to increase
      `NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE`. This helps developers tune cache
      sizes for their workload.
      
      ### Additional Changes
      
      - Renamed header from `x-vercel-id` to `x-invocation-id` for clarity
      - Added `withInvocationId()` test helper for cache testing
      
      ## Test Plan
      
      - Existing response cache tests pass with updated header name
      - Unit tests for `LRUCache` including `onEvict` callback behavior
      - Updated standalone mode tests to use `withInvocationId()` helper
      092458fd
    • Vercel Release Bot's avatar
      Update Rspack production test manifest (#88882) · 4e8671cf
      Vercel Release Bot authored
      This auto-generated PR updates the production integration test manifest used when testing Rspack.
      4e8671cf
    • Niklas Mischkulnig's avatar
    • nextjs-bot's avatar
      v16.2.0-canary.2 · d4e64f52
      nextjs-bot authored
      d4e64f52
    • Tim Neutkens's avatar
      Turbopack: Fix next/font preloading for page.mdx (#88848) · 61bf6f63
      Tim Neutkens authored
      ## What?
      
      This PR fixes font preloading for MDX pages in Turbopack and adds an e2e
      test to verify the fix.
      
      ## Why?
      
      When using `next/font` with MDX pages, font preloading was failing with
      Turbopack because the LoaderTree was storing the **transformed module
      path** instead of the **original source path**.
      
      ## The Bug
      
      In Turbopack, MDX files are transformed by adding a `.tsx` extension:
      - Source file: `app/page.mdx`
      - After transform: `app/page.mdx.tsx`
      
      The `create_module_tuple_code` function in `base_loader_tree.rs` was
      using `module.ident().path()` (the transformed path) instead of the
      original `path` parameter.
      
      This caused a mismatch at runtime:
      - Font manifest key: `[project]/app/page`
      - LoaderTree stored: `[project]/app/page.mdx.tsx`
      - After stripping `.tsx`: `[project]/app/page.mdx`
      - **No match** → fonts not preloaded
      
      ## The Fix
      
      Changed `crates/next-core/src/base_loader_tree.rs` to use the original
      source path:
      
      ```rust
      // Before
      let module_path = module.ident().path().to_string().await?;
      
      // After
      let module_path = path.value_to_string().await?;
      ```
      
      Now the LoaderTree stores `[project]/app/page.mdx`, which after
      stripping `.mdx` at runtime becomes `[project]/app/page`, matching the
      font manifest key.
      
      ## Test
      
      Added `test/e2e/app-dir/mdx-font-preload/` which verifies:
      1. MDX page renders correctly
      2. Font class from layout is applied
      3. Font is correctly preloaded
      
      ## How I tested these changes
      
      ```bash
      pnpm test-start-turbo test/e2e/app-dir/mdx-font-preload/mdx-font-preload.test.ts
      ```
      
      ---------
      Co-authored-by: 's avatarNiklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
      61bf6f63
    • Tim Neutkens's avatar
      Create-next-app update message (#88706) · 85d043a6
      Tim Neutkens authored
      ### What?
      
      This PR fixes `create-next-app` update notifications for prerelease
      versions by checking against the correct npm dist-tag.
      
      ### Why?
      
      Users running `pnpx create-next-app@canary` were incorrectly prompted to
      update to the stable version because:
      
      1. The `update-check` library queries npm's `latest` dist-tag by default
      2. Version comparison using `localeCompare` considers `16.1.1-canary.32`
      less than `16.1.3` (since base version `16.1.1 < 16.1.3`)
      3. This incorrectly triggered an update notification
      
      ### How?
      
      Instead of skipping the update check entirely for prerelease versions,
      this PR:
      
      1. Extracts the dist-tag from the current version (e.g., `canary` from
      `16.1.1-canary.32`)
      2. Passes this as the `distTag` option to `update-check`
      3. Updates the suggested command to include the correct tag (e.g., `pnpm
      add -g create-next-app@canary`)
      
      This ensures:
      - Stable users are notified about newer stable releases
      - Canary users are notified about newer canary releases
      - Beta/RC users are notified about newer versions of their respective
      channels
      Co-authored-by: 's avatarCursor Agent <cursoragent@cursor.com>
      85d043a6
    • Tobias Koppers's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
      [devtools] Wrap long file names of stack frames in the error overlay (#88886) · 71ac1ec7
      Sebastian "Sebbie" Silbermann authored
      https://github.com/user-attachments/assets/0594744b-5dd5-4550-90b8-77071962f666
      
      See [overflow-wrap docs](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/overflow-wrap) for break-word vs anywhere.
      
      
      Just a one-line CSS change. The other changes are renaming functions to disambiguate source/codeframe and the filename.
      71ac1ec7
    • Jiachi Liu's avatar
      37ac3974
    • Matt Mastracci's avatar
      Turbopack: [chore] Fix Rust check warnings (#88871) · acd5d5ed
      Matt Mastracci authored
      # What?
      
      Fix some unimportant `check` warnings that appear as noise in the build logs.
      acd5d5ed
    • Wyatt Johnson's avatar
      docs: add skill for updating Next.js documentation (#88656) · 4095107f
      Wyatt Johnson authored
      ### What?
      
      Adds a new Claude Code skill `/update-docs` that guides maintainers
      through updating Next.js documentation based on code changes.
      
      ### Why?
      
      To help ensure PRs include complete and accurate documentation updates
      by providing a structured workflow, code-to-docs mappings, and quick
      reference materials for Next.js doc conventions.
      
      ### How?
      
      The skill includes:
      - Main workflow in `SKILL.md` with step-by-step guidance for analyzing
      changes, updating docs, and scaffolding new feature documentation
      - `references/DOC-CONVENTIONS.md` - Complete frontmatter schema, code
      block formatting, and MDX component usage
      - `references/CODE-TO-DOCS-MAPPING.md` - Maps source code directories to
      their corresponding documentation paths
      
      ### Usage
      
      **Manual invocation:**
      ```
      /update-docs
      ```
      
      **Automatic triggers** - the skill activates when you mention:
      - "update documentation for my changes"
      - "check docs for this PR"
      - "what docs need updating"
      - "sync docs with code"
      - "scaffold docs for this feature"
      - "document this feature"
      - "review docs completeness"
      - "add docs for this change"
      - "what documentation is affected"
      - "docs impact"
      - References to `docs/`, `docs/01-app`, `docs/02-pages`, or `.mdx files`
      4095107f
    • Luke Sandberg's avatar
      refactor: migrate to typed accessors and remove CachedDataItem adapter (#88397) · 08668326
      Luke Sandberg authored
      Adopt the new generated accessor methods in turbo-tasks-backend.
      
      Remove the CachedDataItem enum and related support macros.
      
      This new approach is more ergonomic, memory efficient, and generates slightly smaller serialized payloads.  
      
      From measuring vercel-site:
      ```
      canary@e05510ab3bf91c02c7381e2c471363561ffa1198:
      $ hyperfine -p 'rm -rf .next' -w 2 -r 10  'pnpm next build --turbopack --experimental-build-mode=compile'
      Benchmark 1: pnpm next build --turbopack --experimental-build-mode=compile
        Time (mean ± σ):     55.981 s ±  0.885 s    [User: 386.683 s, System: 111.484 s]
        Range (min … max):   54.438 s … 57.723 s    10 runs
      ```
      
      ```
      01-09-migrate-to-typed-accessors@d343fad5bf92af9c5271c62a24aedcf02c3d83d4
      $ hyperfine -p 'rm -rf .next' -w 2 -r 10  'pnpm next build --turbopack --experimental-build-mode=compile'
      Benchmark 1: pnpm next build --turbopack --experimental-build-mode=compile
        Time (mean ± σ):     54.897 s ±  0.496 s    [User: 389.400 s, System: 127.353 s]
        Range (min … max):   54.298 s … 55.681 s    10 runs
      ```
      
      so a small savings of a little over a second.  Not too bad for mostly removing a bunch of `match` expressions that were required in the old model.
      
      similarly we should expect a small progression in disk size since we no longer explode into `Vec<CachedDataItem>` which induces some overhead from redundantly encoding enum descriminents and not being able to 'length prefix' collections.
      
      from a clean `.next` dir on vercel-site, and a production build with caching enabled, the cache size is
      
      before
      ```
      $ du -h .next/cache
      4.3G	.next/cache/turbopack/v16.1.0-canary.0-518-ge05510ab
      ```
      after
      ```
      $ du -h .next/cache
      4.1G	.next/cache/turbopack/v16.1.0-canary.0-546-gd343fad5bf92
      ```
      Which is expected, the main thing we are winning in terms of cache size is the CachedDataItem descriminent values, and in this build we were serializing about 260M items, so we save 1 byte for each of them.
      
      In some measurements i saw much more dramatic wins of >1gb, which i do not have a great explanation for.
      08668326
    • Benjamin Woodruff's avatar
      Turbopack: Use webpki-root-certs in addition to rustls-platform-verifier on… · 78bc2bad
      Benjamin Woodruff authored
      Turbopack: Use webpki-root-certs in addition to rustls-platform-verifier on Linux for bare-bones Linux images without root CA stores (#88869)
      
      This should fix the user-reported issue here:
      https://github.com/vercel/next.js/pull/88290#issuecomment-3762940063
      
      That issue occurs when building with bare-bones docker images that
      contain no root CA store.
      
      It's inconvenient to test inside of a bare-bones docker image, but I did
      at least test this works on a normal (Debian) Linux install when
      fetching fonts for shadcn-ui.
      78bc2bad
    • Luke Sandberg's avatar
      feat: Replace InnerStorage with the generated TaskStorage struct (#88355) · 21fcfb01
      Luke Sandberg authored
      ## What
      
      Replace `InnerStorage` with `TaskStorage` generated by the new derive macro from #88338 . 
      
      Extend the TaskStorage derive macro to generate `CachedDataItem` adapter methods on the `TaskStorageAccessors` trait so we can maintain API compatibility. 
      
      Replace the serialization layer to use the native TaskStorage representations now that CachedDataitem is only used for API access
      
      ## Why
      
      TaskStorage will enable more performant serialization and access patterns.  From testing on vercel-site this saves ~1% of persistent cache size.  For this PR there is no benefit to access pattern performance (in fact i would anticipate a small regression due to the adaptor layer)
      
      ## How
      
      1. **Extended macro attribute parsing** - Added `variant`, and `key_field`` attributes to specify CachedDataItem variant mapping per field
      
      2. **Generated adapter methods on TaskStorageAccessors trait**:
         - `insert_kv(item)` - Insert a CachedDataItem into typed storage
         - `get(key)` - Look up by CachedDataItemKey
         - `remove(key)` - Remove by key
         - `get_mut(key)` - Mutable access (returns None for flags/sets/multimaps)
         - `iter(type)` - Iterate over a specific variant type
        - ...
      
         This enables current access patterns to keep working
      
      3. **Migrated serialization and deserialization flow**:
         - use `TaskStorage` throughout the serialization flow using apis like `restore_from` and `clone_data` to create targeted copies for lock free IO.
          
      4. **Removed new dead code** - Delete the `Storage` layer now that it is dead.
      
      On its own this will be a small savings in serialized data size (saves 20Mb for vercel-site) and is slightly faster to snapshot/restore.  Access performance should be nearly equivalent in performance.
      21fcfb01
    • Benjamin Woodruff's avatar
      Turbopack: Tweak retry loop for link creation to try to fix os error 80 on Windows (#88669) · 8fe8ff79
      Benjamin Woodruff authored
      Though I've been unable to reproduce the issue (prior PRs in this stack are my attempts at that), I believe this *should* fix the OS Error 80 ([`ERROR_FILE_EXISTS`](https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-)) that we've seen users report on Windows: https://github.com/vercel/next.js/discussions/88382
      
      Basically instead of deleting the existing link in a retry loop, and then trying to create new new link using a retry loop, we should instead:
      - Merge these two retry loops into one, in case another process creates the link after we delete it. This shouldn't typically happen, but could theoretically happen.
      - Extend the retry logic to also retry on [`ErrorKind::AlreadyExists`](https://github.com/rust-lang/rust/blob/503745e9170b40841611aaaa634641edffd00b29/library/std/src/sys/io/error/windows.rs#L19). This might be possible if the filesystem is eventually consistent (which can happen on Windows), but I wasn't able to reproduce this.
      
      There's a similar -- but different -- issue that users have been reporting where they get OS Error 1 (`ERROR_INVALID_FUNCTION`) on Windows. I believe this happens if we try to create a junction point on a non-NTFS filesystem. In that case, we need to report a clearer issue to the user instead of bubbling this up as an internal Turbopack error.
      
      I tested this on Windows with the symlink fuzzer from #88667, as well as `cargo test -p turbo-tasks-fs`:
      
      ![Screenshot 2026-01-16 at 2.16.23 PM.png](https://app.graphite.com/user-attachments/assets/5c86e09b-c5e5-4ff2-9d89-da009917a018.png)
      8fe8ff79
    • Benjamin Woodruff's avatar
      Turbopack: Various cleanup for turbo-tasks-fs, mostly retry logic and string formatting (#88668) · f263c562
      Benjamin Woodruff authored
      - https://github.com/vercel/next.js/pull/87661 removed the `tokio::task::spawn_blocking` call from `retry_blocking`, so we can simplify things a lot by removing the `Send + 'static` bounds, and eliminate a bunch of cloning `Path`s into `PathBuf`s.
      - `retry_blocking` no longer takes a path argument. After removing the path cloning requirements, it's now easier for callers to capture paths via a closure, and it's more flexible for IO operations that need to pass in more than a single path.
      - Adds `retry_blocking_custom`, which I use in #88669 that allows customizing what error kinds we retry on.
      - Adds documentation to `retry_blocking` explaining why we need this. It's often unclear to new people on the team why we have to retry filesystem operations (Windows, basically). This was unclear to me when I was new to this code, and other people have asked similar questions.
      - We shouldn't use `Path::display` for error messages or tracing spans. It's easier to use `Debug`, and `Debug` ensures that if the error is related to unicode, that information isn't lost in the error message.
      - More consistently apply tracing spans using `.instrument`.
      - Use the modern inline syntax for some format strings.
      - `let foo = RcStr::from(bar)` is preferred over `let foo: RcStr = bar.into()`
      f263c562
    • Matt Mastracci's avatar
      Turbopack: Make the priority_runner testcase deterministic (#88651) · 4674a435
      Matt Mastracci authored
      # What
      
      Fixes the `test_mixed_cpu_bound_and_waiting_tasks` to avoid flakes.
      
      # Why
      
      The `test_mixed_cpu_bound_and_waiting_tasks` was non-deterministic and relied on thread scheduling order.
      
      The previous test relied on timing-based synchronization using sleep() calls with varying durations to simulate CPU-bound and async work. This approach was inherently flaky because:                                            
      
        1. Thread scheduling is non-deterministic - a task sleeping for 10ms might complete before one sleeping for 5ms  
        depending on OS scheduler behaviour                                                                               
        2. The assertions depended on specific completion ordering that wasn't guaranteed by the timing                  
        3. Test behaviour could vary based on system load, available cores, and Tokio runtime scheduling                  
      
      # How
      
      he new approach uses std::sync::Barrier pairs (start, finish) for each task, giving the test explicit control over when tasks can proceed.
      
      Because this is a priority-ordered system, we know which barriers should be available at any given time and can release them. If the given task is not current waiting on its own corresponding barrier, the test will fail.
      4674a435
  3. 21 Jan, 2026 4 commits