Skip to content

Strip redundant nodejs_compat flags - #15148

Merged
jamesopstad merged 1 commit into
mainfrom
james/strip-redundant-nodejs-compat
Aug 12, 2026
Merged

Strip redundant nodejs_compat flags#15148
jamesopstad merged 1 commit into
mainfrom
james/strip-redundant-nodejs-compat

Conversation

@jamesopstad

@jamesopstad jamesopstad commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Ignore a nodejs_compat compatibility flag that the compatibility date already enables

Fixes #15146

workerd rejects a compatibility flag that its compatibility date enables by default, so a Worker configured with both a compatibility date of 2026-08-04 or later and nodejs_compat failed to start locally with "The compatibility flag nodejs_compat became the default as of 2026-08-04 so does not need to be specified anymore".

The redundant nodejs_compat and nodejs_compat_v2 flags are now dropped when starting the runtime, which has no effect on the resulting Worker because the compatibility date enables both anyway. no_nodejs_compat and no_nodejs_compat_v2 still switch Node.js compatibility off, and a flag specified alongside its own opt-out is left alone so that workerd still reports those as contradictory.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bug fix

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot

changeset-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e013f7d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@cloudflare/vitest-pool-workers Patch
@cloudflare/vite-plugin Minor
miniflare Minor
wrangler Minor
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Aug 12, 2026
@workers-devprod
workers-devprod requested review from a team and NuroDev and removed request for a team August 12, 2026 12:31
@workers-devprod

workers-devprod commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk

ask-bonk Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Good, the test helper exists. The implementation is well-tested and correct. Let me do one final sanity check on the miniflare test — whether it's actually verifying the fix. The test creates a worker with nodejs_compat + nodejs_compat_v2 on the default-on date, imports node:path, and expects it to work. This confirms both that the worker starts (no redundant-flag rejection) AND that node compat is still active (path.join works). Solid test.

I've completed a thorough review. The core logic is correct:

  • Stripping only occurs when workerd would reject the flag (default-on date, no matching opt-out).
  • Behavior is preserved per resolveNodejsCompat in all cases.
  • The per-service placement in miniflare (vs shared config) is correctly justified by the Workflows engine worker's hardcoded older compat date.
  • Tests cover the strip, keep-opt-out, contradiction, per-flag, and exact-match cases.

The only borderline point is the contradiction case still failing to start (since workerd emits the redundant-flag error independent of the contradictory error), but this is intentional and consistent with the changeset's stated goal of surfacing the contradiction. That's a reasonable design choice, not a bug.

No actionable issues.

LGTM

github run

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Aug 12, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15148

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15148

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15148

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15148

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15148

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15148

miniflare

npm i https://pkg.pr.new/miniflare@15148

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15148

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15148

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15148

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15148

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@15148

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15148

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15148

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15148

wrangler

npm i https://pkg.pr.new/wrangler@15148

commit: e013f7d

Comment thread packages/workers-utils/src/compatibility-date.ts

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Aug 12, 2026
@jamesopstad
jamesopstad merged commit 0b82b15 into main Aug 12, 2026
77 of 78 checks passed
@jamesopstad
jamesopstad deleted the james/strip-redundant-nodejs-compat branch August 12, 2026 13:15
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[C3] Nuxt: Nitro injects nodejs_compat, which workerd now rejects as redundant

4 participants