Skip to content

Use a fixed default compatibility date derived from the pinned workerd - #15185

Merged
jamesopstad merged 1 commit into
mainfrom
james/default-compat-date
Aug 15, 2026
Merged

jamesopstad merged 1 commit into
mainfrom
james/default-compat-date

Conversation

@jamesopstad

@jamesopstad jamesopstad commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

When no compatibility date is set, Wrangler, C3 and the Vitest pool all defaulted to the current date. workerd only accepts a compatibility date up to 7 days beyond its own release, so the default could get ahead of the runtime that had been installed and local development would fail to start.

This adds a single DEFAULT_COMPAT_DATE constant to @cloudflare/workers-utils, committed to the repo and derived from the workerd version pinned in the pnpm catalog. That leaves a week of headroom and can never exceed what the shipped runtime supports.

Keeping it current is automated. pnpm check:compat-date, which runs as part of pnpm check, fails if the constant and the pin drift apart. Dependabot's workerd bump PRs refresh the constant in the same commit.

--latest is affected too. wrangler deploy --latest, wrangler versions upload --latest and wrangler pages download config (for projects set to always use the latest compatibility date) all wrote the current date into a config file for later commands to use, which could leave a project unable to run wrangler dev. These now resolve to the same fixed default, and the flag's help text and warning have been reworded to match.

getTodaysCompatDate() is deliberately retained for validation in packages/miniflare/src/plugins/core/index.ts, which must keep comparing against the real current date.


  • 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: compatible with existing documentation

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

@changeset-bot

changeset-bot Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6567b08

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

This PR includes changesets to release 4 packages
Name Type
wrangler Patch
create-cloudflare Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers 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 14, 2026
@workers-devprod
workers-devprod requested review from a team and NuroDev and removed request for a team August 14, 2026 11:12
@workers-devprod

workers-devprod commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions

github-actions Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk

ask-bonk Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

All consistent. I've completed a thorough review of the changes across all 45 files. The PR:

  • Introduces a single committed DEFAULT_COMPAT_DATE constant derived from pinned workerd
  • Correctly replaces getTodaysCompatDate() at all default-value sites while retaining it for the miniflare validation comparison (line 271, which legitimately needs the real current date)
  • The --latest resolution and pages download-config changes are consistent
  • The automation tooling (update-default-compat-date.ts) has a robust cross-check that gracefully degrades and only asserts when the installed workerd matches the pinned version
  • The dependabot integration guards correctly (only refreshes on workerd bumps, safe timing with the version-equality check)
  • Tests are comprehensive and the "not in the future" assertion is non-flaky
  • The deleted build-constants.ts is fully cleaned up with no stale references

The logic is sound, backward compatibility is preserved (unstable_getDevCompatibilityDate still works, deprecation note updated appropriately), and there are no security or API-behavior issues. No actionable issues found.

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

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

@cloudflare/config

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

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 6567b08

devin-ai-integration[bot]

This comment was marked as resolved.

@jamesopstad
jamesopstad marked this pull request as draft August 14, 2026 11:26
@jamesopstad
jamesopstad force-pushed the james/default-compat-date branch 2 times, most recently from df6ab5a to d35dec1 Compare August 14, 2026 12:37
@jamesopstad
jamesopstad marked this pull request as ready for review August 14, 2026 13:06

@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 14, 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.

3 participants