fix(deps): revert next to 16.2.12, its 16.3.0 optimizer deletes live code (#6242)

Next 16.3.0's Turbopack optimizer models a bare `return <asyncCall>()` tail
call inside an async function as returning the promise object, then propagates
that always-truthy fact through the caller's `await`. Where the result feeds an
`if (x)` whose every branch returns, it concludes the branch is always taken and
deletes everything after it from the emitted bundle.

Two sites shipped to production that way:

- `POST /api/credentials` lost its entire create path — the transaction, the
  org locks, the insert, the audit, the 201. A first-time create fell into the
  existing-credential branch and threw on `existingCredential.id`, so every new
  credential 500'd.
- `upsertAsyncToolCall` collapsed to `async () => await getAsyncToolCall(id)`.
  The insert is simply gone; it returns null for every new async copilot tool
  call. Silent — no error, no failed request.

A differential scan of 71,266 source string literals across `.next/server` and
`.next/static`, comparing images built from the same commit on 16.2.12 and
16.3.0, found exactly these two and nothing else. That scan cannot see dropped
branches with no distinctive string literal, which is why the version goes back
rather than the two sites being patched alone.

Both are also hardened with `return await`, verified to defeat the miscompile in
a minimal reproduction. The TypeScript toolchain cleanup from the original bump
(dropping @typescript/native-preview, `useTypeScriptCli`) is kept.
This commit is contained in:
Waleed
2026-08-03 22:31:43 -07:00
committed by GitHub
parent 40cbee4934
commit 2977db5133
8 changed files with 128 additions and 49 deletions
+6 -6
View File
@@ -79,8 +79,8 @@
"overrides": {
"react": "19.2.4",
"react-dom": "19.2.4",
"next": "16.3.0",
"@next/env": "16.3.0",
"next": "16.2.12",
"@next/env": "16.2.12",
"drizzle-orm": "^0.45.2",
"postgres": "^3.4.5",
"minimatch": "^10.2.5",
@@ -89,10 +89,10 @@
"e2b": "^2.36.1"
},
"optionalDependencies": {
"@next/swc-darwin-arm64": "16.3.0",
"@next/swc-darwin-x64": "16.3.0",
"@next/swc-linux-arm64-gnu": "16.3.0",
"@next/swc-linux-x64-gnu": "16.3.0"
"@next/swc-darwin-arm64": "16.2.12",
"@next/swc-darwin-x64": "16.2.12",
"@next/swc-linux-arm64-gnu": "16.2.12",
"@next/swc-linux-x64-gnu": "16.2.12"
},
"devDependencies": {
"@biomejs/biome": "2.0.0-beta.5",