Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Jan 27, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

lukesandberg and others added 11 commits January 26, 2026 12:42
#88967)

## What?

This PR reapplies #87746 which adds bundling support for Node.js `worker_threads` in Turbopack.

## Why?

The original PR (#87746) was reverted in #88725 because it broke builds that use packages like `pino` with transports. These packages use dynamic patterns like `join(__dirname, 'lib', 'worker.js')` to resolve worker entry points, which can match non-evaluatable files like `package.json` or `tsconfig.json`.

## How?

This PR reapplies the original changes with the following fixes:

1. **Downgrade errors to warnings in tracing contexts**: When `loose_errors` is enabled (tracing mode) or `in_try` is true, worker entry point validation errors are now emitted as warnings instead of errors. This follows the established Turbopack pattern used in `handle_resolve_error` and other resolve error handling.

2. **Improved error messages**: Error messages for non-chunkable and non-evaluatable worker entry point modules now include:
   - The module identifier (so you can see which file caused the issue)
   - The issue source location (pointing to the `new Worker()` call in source code)

3. **Added regression test**: A new pino-based test case exercises the `thread-stream` worker pattern that caused the original failure. This test runs in `CodeGenerationAndTracing` mode via `test-start-turbo`.

## Changes from original PR

- Added `source` field to `CodeGenerationIssue` to support showing issue source locations
- Added `get_issue_severity()` helper that checks `loose_errors` and `in_try` to determine severity
- Fixed typo: `"SharedbWorker"` → `"SharedWorker"` in `to_string` implementation
- Added pino regression test in `test/e2e/app-dir/node-worker-threads/`

## Testing

- ✅ `pnpm test-dev-turbo test/e2e/app-dir/node-worker-threads/` - all tests pass
- ✅ `pnpm test-start-turbo test/e2e/app-dir/node-worker-threads/` - all tests pass (exercises bundling mode)
- ✅ Verified test fails without the `loose_errors` fix
- ✅ Verified vercel-docs build succeeds with warnings instead of errors
…ed growth (#89040)

### What?

Prevent LRU cache unbounded growth by requiring `calculateSize` to
return values > 0.

### Why?

When `calculateSize` returned 0 (e.g., for `null` values in the
filesystem route cache), items were never evicted because they didn't
contribute to `totalSize`. This caused unbounded memory growth when
handling dynamic routes like `/api/logs/[id]` where each unique ID
created a new cache entry with size 0.

### How?

1. **LRUCache now throws an error if size ≤ 0** - This catches bugs at
development time rather than silently masking them:
   ```typescript
   if (size <= 0) {
     throw new Error(
\`LRUCache: calculateSize returned ${size}, but size must be > 0. \` +
\`Items with size 0 would never be evicted, causing unbounded cache
growth.\`
     )
   }
   ```

2. **Fixed filesystem.ts** - Null entries (negative cache) now return
size 1 instead of 0:
   ```typescript
   if (!value) {
// Null entries (negative cache) still need a non-zero size for LRU
eviction
     return 1
   }
   ```

3. **Fixed next-dev-server.ts** - Static paths cache now uses `|| 1`
instead of `?? 0`:
   ```typescript
   return JSON.stringify(value.staticPaths)?.length || 1
   ```
As a defense-in-depth mechanism, we're converting the server actions
manifests and client reference manifests to use null-prototype objects,
so that property lookups cannot traverse `Object.prototype`.
This script has been quietly failing on cron occasionally, this updates
to ensure it shows as failing when the inner requests fail and also adds
back-off logic for re-creating the project after deleting the previous.

x-ref:
https://github.com/vercel/next.js/actions/runs/21327384008/job/61386921911#step:6:12
This applies the following builder changes to the adapters outputs as
well:

- vercel/vercel#14689
- vercel/vercel#14695
… async loader mapping" (#89073)

Reverts #88775

This is breaking the v0 marketing site, reverting to unblock.
@pull pull bot locked and limited conversation to collaborators Jan 27, 2026
@pull pull bot added the ⤵️ pull label Jan 27, 2026
@pull pull bot merged commit 59db275 into code:canary Jan 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants