Skip to content

chore(deps): upgrade next to 16.3.1, its optimizer no longer deletes live code - #6777

Merged
waleedlatif1 merged 2 commits into
stagingfrom
chore/upgrade-next-16-3-1
Aug 17, 2026
Merged

chore(deps): upgrade next to 16.3.1, its optimizer no longer deletes live code#6777
waleedlatif1 merged 2 commits into
stagingfrom
chore/upgrade-next-16-3-1

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Upgrades next 16.2.12 -> 16.3.1 across the root overrides, the @next/swc-* optional deps, apps/sim, apps/docs, and packages/emcn.
  • We reverted 16.3.0 in fix(deps): revert next to 16.2.12, its 16.3.0 optimizer deletes live code #6242 because its Turbopack optimizer modelled a bare return <asyncCall>() tail call inside an async function as returning the promise object, carried that always-truthy fact through the caller's await, and deleted everything after the resulting if. That shipped two dead paths to production: the entire POST /api/credentials create path, and the insert inside upsertAsyncToolCall.
  • We reported it as vercel/next.js#96595. The fix — #96601, "[turbopack] Collapse nested promises in the analyzer" — folds Promise<Promise<T>> to Promise<T> in the analyzer. It was backported as #96675 and shipped in 16.3.1.
  • Restores the two next.config.ts comments that were reworded to describe sitting on 16.2.12.

Verification

Confirmed the fix before taking the bump, two independent ways:

  • The minimal reproduction linked from our issue no longer reproduces on 16.3.1 — all four routes keep their code. On 16.3.0, /api/broken lost everything after the if.
    next 16.3.1
    route                          code after the `if`
    /api/broken                    kept
    /api/fixed                     kept
    /api/control-no-wrapper        kept
    /api/control-nonreturning-if   kept
    
  • A production build of apps/sim on 16.3.1 still emits the marker strings whose disappearance was the original signal: credential_connected (43 files under .next/server), acquireOrganizationUserMutationLocks (28), and the upsertAsyncToolCall insert-path warning (10).

The return await hardening added to both sites in the revert stays as is, and so does the TypeScript toolchain configuration.

Supply-chain gate

16.3.1 published 2026-08-13, so it sits inside the 7-day minimumReleaseAge window until 2026-08-20 and cannot install without an exclusion. The alternative is staying on 16.2.12 — a release whose successor we already reverted once — so the entries go in dated, with a note to drop them on the next touch of the file. The mermaid and js-yaml exclusions aged out on 2026-08-11 and 2026-08-07 and are dropped here per that same rule; both still resolve to their pinned versions.

Type of Change

  • Chore / dependency upgrade

Testing

  • apps/sim production build passes on 16.3.1 (compile 87s, TypeScript 4.4s, all routes emitted).
  • bun run check:audits — 29/29 pass.
  • bun run lint clean; block-registry audit passes.
  • Minimal Turbopack DCE reproduction + emitted-chunk marker grep, both described above.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…live code

16.3.0 was reverted in #6242 because its Turbopack optimizer modelled a bare
`return <asyncCall>()` tail call inside an async function as returning the
promise object, propagated that always-truthy fact through the caller's `await`,
and deleted everything after the resulting `if`. That shipped two dead code
paths to production: the whole `POST /api/credentials` create path, and the
insert inside `upsertAsyncToolCall`.

We reported it as vercel/next.js#96595. The fix — "[turbopack] Collapse nested
promises in the analyzer" (vercel/next.js#96601) — folds `Promise<Promise<T>>`
to `Promise<T>` in the analyzer, and was backported as #96675 and released in
16.3.1.

Verified before taking the bump:

- The minimal reproduction from the issue no longer reproduces on 16.3.1. All
  four routes keep their code; on 16.3.0 `/api/broken` lost everything after
  the `if`.
- A production build of `apps/sim` on 16.3.1 still emits the markers whose
  disappearance was the original signal: `credential_connected` (43 files),
  `acquireOrganizationUserMutationLocks` (28), and the `upsertAsyncToolCall`
  insert-path warning (10).

The `return await` hardening added to both sites in the revert stays as is, and
so does the TypeScript toolchain configuration.

16.3.1 published 2026-08-13, so it is inside the 7-day `minimumReleaseAge`
supply-chain window until 2026-08-20 and needs an exclusion to install. The
alternative is sitting on 16.2.12, whose successor we already reverted once, so
the entries go in dated and come out on the next touch of the file. The mermaid
and js-yaml exclusions aged out on 2026-08-11 and 2026-08-07 and are dropped
here per that same rule.
@waleedlatif1
waleedlatif1 requested a review from a team as a code owner August 17, 2026 17:44
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 17, 2026 6:29pm

Request Review

@cursor

cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Framework bump on the main app and docs with prior 16.3.0 production DCE history; mitigated by the shipped analyzer fix and retained return await hardening, but still warrants build/smoke validation on deploy targets.

Overview
Bumps Next.js from 16.2.12 to 16.3.1 everywhere it is pinned: root package.json overrides and optional @next/swc-* deps, apps/sim, apps/docs, packages/emcn, and bun.lock.

The upgrade targets the Turbopack dead-code elimination fix for vercel/next.js#96595 (shipped in 16.3.1 after the 16.3.0 revert in #6242), which had removed live production paths such as POST /api/credentials create and the upsertAsyncToolCall insert path.

bunfig.toml adds dated minimumReleaseAge exceptions for next, @next/env, and all eight @next/swc platform packages (so Alpine/Windows lockfile resolution still works), and removes aged-out mermaid and js-yaml exclusions. Comments in apps/sim/next.config.ts are tweaked to describe why turbopackFileSystemCacheForBuild: false and useTypeScriptCli: true remain explicit pins on 16.3.x.

Reviewed by Cursor Bugbot for commit 5ef8a06. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR upgrades Next.js and associated packages to 16.3.1, which includes the Turbopack optimizer correction, and updates release-age handling for the newly published packages.

  • Aligns Next.js versions across the root workspace, Sim app, docs app, and EMCN package.
  • Updates the lockfile for Next.js, SWC, PostCSS, and related dependencies.
  • Exempts Next.js, @next/env, and all eight SWC platform binaries from the temporary release-age gate.
  • Restores configuration comments describing the relevant Next.js behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
bunfig.toml The follow-up fix now exempts all eight SWC platform packages, covering the Alpine and Windows variants identified in the previous review.
bun.lock The lockfile contains all eight SWC 16.3.1 binaries and retains the existing sharp 0.35.3 platform packages.
package.json Root Next.js, environment, and directly pinned SWC versions are consistently upgraded to 16.3.1.
apps/sim/package.json The Sim application updates its direct Next.js dependency to 16.3.1.
apps/docs/package.json The documentation application updates its direct Next.js dependency to 16.3.1.
packages/emcn/package.json The EMCN package updates its Next.js dependency consistently with the workspace override.
apps/sim/next.config.ts Comments are updated to reflect the upgraded Next.js version while preserving the existing cache and TypeScript CLI settings.

Reviews (2): Last reviewed commit: "fix(deps): keep the musl and win32 SWC b..." | Re-trigger Greptile

Comment thread bunfig.toml
The release-age exclusion only listed the four @next/swc platforms that
package.json pins, but next declares all eight as its own optionalDependencies,
so all eight are normally resolved into bun.lock. A gated optional dependency
does not fail the install — bun drops it silently — so the first install
stripped both musl variants and both win32 variants from the lockfile.

That left the Alpine devcontainer and any Windows machine with no SWC binary to
resolve. Adding the remaining four to the exclusion list restores all eight
entries at 16.3.1.

Worth knowing for the next time this happens: bun.lock is sticky here. Once an
optional dependency has been dropped, re-running the install — even with
--force, even with the age gate switched off entirely — does not bring it back,
because the resolution is not reattempted. The lockfile has to be regenerated
from a base that still contains the entries, which is why this restores
bun.lock from staging before re-applying the bump.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5ef8a06. Configure here.

@waleedlatif1
waleedlatif1 merged commit 746a449 into staging Aug 17, 2026
31 of 32 checks passed
@waleedlatif1
waleedlatif1 deleted the chore/upgrade-next-16-3-1 branch August 17, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant