Skip to content

fix(deps): upgrade Next.js to 16.4.2 - #100

Merged
keyurgolani merged 2 commits into
nextfrom
fix/deps-next-16-security
Oct 20, 2026
Merged

keyurgolani merged 2 commits into
nextfrom
fix/deps-next-16-security

Conversation

@keyurgolani

@keyurgolani keyurgolani commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Implements CHECKMATE-22.1 · gate A (item 16 follow-up)
Refs #92

Bumps next from 16.1.1 to 16.4.2, the newest 16.x. npm audit reports critical upstream advisories against next@16.1.1 (GHSA-p293-qw3h-jr36, GHSA-2xp9-vwfh-vxw4), and 16.4.2 picks up the upstream fixes.

The only code change is next.config.ts, which turns off three new defaults:

  1. logging.serverFunctions. Since 16.2, next dev prints every Server Function call with its arguments, so saving Settings would print what was typed into the form.
  2. agentRules. Since 16.3, next dev writes an AGENTS.md into the repo root when it runs under a coding agent.
  3. experimental.agentUpgrade. Since 16.4, agent-run builds query the advisory API and can fail once on a new advisory. npm audit already tracks that.

The lockfile only moves packages in next's own tree: @next/env, @next/swc-*, @swc/helpers, sharp 0.35.5 with its @img/* binaries, postcss 8.5.23 (now deduped to the top level, so vite and @tailwindcss/postcss resolve it too), nanoid, baseline-browser-mapping and a nested semver. The installed react stays at 19.2.3. The App Router's bundled React canary moves with next.

eslint-config-next stays at 16.1.1. Moving it to 16.4.2 adds 30 lint errors and 1 warning across 20 files. The errors come from eslint-plugin-react-hooks 7.1, which 16.4.x requires, mostly set-state-in-effect on mounted-flag effects like this one in header.tsx. The lint gate doesn't allow the increase and the bump fixes no next advisory, so it can go with gate B's lint baseline.

npm audit:

next@16.1.1 next@16.4.2
critical 3 2
high 18 15
total 33 28

next, postcss, sharp and nanoid drop out. Still critical: vitest and @vitest/coverage-v8. Still high: brace-expansion, browserslist, flatted, js-yaml, minimatch, picomatch, rollup, source-map-js, undici, vite, and braces with the four packages that pull it in (micromatch, fast-glob, @next/eslint-plugin-next, eslint-config-next). braces has no fixed release, and @next/eslint-plugin-next 16.4.2 still pins fast-glob@3.3.1.

Verified on the rebased branch, against next with the gate A fixture:

  1. Lint: next.config.ts lints clean, no new findings overall, no eslint-disable added.
  2. npx tsc --noEmit: 0 errors.
  3. npm test: 23 files, 290 tests pass on the PocketBase fixture.
  4. npm run build with both PocketBase URLs on 127.0.0.1:9 passes, same route table.
  5. npm start with the same closed URLs: /, /signin, /signup, /discover and static assets return 200 with the same page text as 16.1.1. Sign-in and sign-out cookies, the proxy's 401 on protected API routes, and Server Action origin checks behave the same.
  6. next dev under an agent no longer writes AGENTS.md.
  7. Standalone output (DOCKER_BUILD=true) traces the same project files as 16.1.1, and the production image builds and serves the same pages.

New build warnings, nothing blocking:

  1. The Edge Runtime is deprecated as of 16.3, so the build flags runtime = 'edge' in opengraph-image.tsx and twitter-image.tsx.
  2. Turbopack now warns that the dynamic fs reads in schema-init.ts pull the whole project into standalone output. 16.1.1 traced the same files without saying so.

ImageResponse also switched its default font to Geist in 16.2, so the OG images render in Geist now.

No owner steps.

Summary by Sourcery

Upgrade Next.js to the latest 16.x release while preserving existing development, build, and runtime behavior.

Bug Fixes:

  • Upgrade Next.js from 16.1.1 to 16.4.2 to incorporate upstream security fixes and reduce reported dependency vulnerabilities.

Enhancements:

  • Disable Next.js development behaviors that expose Server Function arguments, generate agent instruction files, or perform advisory checks during agent-run builds.

Tests:

  • Verify linting, type checking, tests, production builds, runtime behavior, standalone output, and Docker serving remain successful after the upgrade.

@sourcery-ai

sourcery-ai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This dependency-only PR pins Next.js to 16.4.2 and regenerates the lockfile, reducing upstream audit findings while retaining the existing lint configuration and application dependency versions. Verification indicates unchanged type-check, build, runtime, route, browser, and container behavior; reviewers should separately track the documented deprecation warnings, residual vulnerabilities, lint baseline, and required rebase.

File-Level Changes

Change Details Files
Upgrade the production Next.js dependency to the latest 16.x release to incorporate upstream security fixes while preserving the existing React and application dependency versions.
  • Changed the pinned next version from 16.1.1 to 16.4.2.
  • Regenerated the lockfile for Next.js runtime, compiler, image, SWC, PostCSS, and related transitive dependency changes.
  • Kept React at 19.2.3 and eslint-config-next at 16.1.1 to avoid introducing the separate lint baseline increase.
package.json
package-lock.json
Validated that the dependency-only upgrade preserves application behavior, build output, and production packaging.
  • Confirmed TypeScript, build, startup smoke tests, hydration, and key route responses match the previous version.
  • Verified standalone tracing and Docker production behavior, including PocketBase schema packaging.
  • Confirmed existing lint and backend-test failures are unchanged rather than introduced by the upgrade.
package.json
package-lock.json
Documented upgrade-related warnings and the remaining audit exposure for reviewer follow-up.
  • Flagged the new Edge Runtime deprecation warnings and Turbopack standalone-tracing warning.
  • Recorded residual critical and high vulnerabilities outside the Next.js upgrade scope, including the unfixed braces advisory.
  • Noted that eslint-config-next should be addressed separately with the gate B lint baseline and that the branch requires a post-merge rebase.
package.json
package-lock.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!

Fixed security issues:


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@keyurgolani
keyurgolani force-pushed the fix/deps-next-16-security branch from 17a9509 to 2fae14e Compare October 20, 2026 10:32
npm audit reports critical upstream advisories against next@16.1.1. 16.4.2 is the newest 16.x and picks up the upstream fixes. The lockfile change stays inside next's own dependency tree.
…agent hooks

Next 16.2 logs every Server Function call with its arguments in next dev,
which prints values typed into forms. 16.3 writes AGENTS.md into the repo
when next dev runs under a coding agent, and 16.4 lets agent-run builds
fail once on a new advisory. Turn all three off.
@keyurgolani
keyurgolani force-pushed the fix/deps-next-16-security branch from 2fae14e to 98158d8 Compare October 20, 2026 10:34
@keyurgolani
keyurgolani merged commit 6bf1526 into next Oct 20, 2026
10 checks passed
@keyurgolani
keyurgolani deleted the fix/deps-next-16-security branch October 20, 2026 10:46
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