Skip to content

Clamp C3's scaffolded compatibility_date to the bundled workerd's supported date - #15210

Closed
nithin42 wants to merge 1 commit into
cloudflare:mainfrom
nithin42:clamp-c3-compat-date
Closed

nithin42 wants to merge 1 commit into
cloudflare:mainfrom
nithin42:clamp-c3-compat-date

Conversation

@nithin42

Copy link
Copy Markdown
Contributor

Closes #14942.

C3 writes today's date as the compatibility_date of a new project, but the workerd that the scaffolded project pins can be a day or two behind today. When it is, the project fails to start on its very first dev, before the user has written any code, with:

This Worker requires compatibility date "2026-08-15", but the newest date
supported by this server binary is "2026-08-11".

Editing the date down by hand fixes it, but the error names a date C3 itself generated, so it reads as "the runtime is broken" rather than "the scaffold is a couple of days ahead." This is the same failure mode as #1948, just from C3 rather than wrangler init, so that earlier fix doesn't cover this path.

getWorkerdCompatibilityDate now clamps today's date to the newest date the bundled workerd supports. workerd is versioned as 1.YYYYMMDD.x, where the middle component is exactly that date, so the ceiling is read from workerd/package.json (added as a dependency, mirroring how git.ts already reads the version out of wrangler/package.json). If the version string ever fails to parse, it falls back to today's date unchanged rather than guessing. C3 pins the same workerd it scaffolds into the project, so the date it caps to is the one the new project will actually run against.

I verified it against the currently bundled workerd (1.20260811.1): with today at 2026-08-15 the generated date is now 2026-08-11 instead of 2026-08-15. Added two unit tests, one for the normal case where today is within range and one for the clamp, and checked the clamp test fails on main and passes with this change. oxlint, oxfmt and the package's existing compat-date tests are all green.

@changeset-bot

changeset-bot Bot commented Aug 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17faf17

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

This PR includes changesets to release 1 package
Name Type
create-cloudflare 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 15, 2026
@workers-devprod
workers-devprod requested review from a team and petebacondarwin and removed request for a team August 15, 2026 19:38
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/clamp-c3-compat-date.md: [@cloudflare/wrangler]
  • packages/create-cloudflare/package.json: [@cloudflare/wrangler]
  • packages/create-cloudflare/src/helpers/tests/compatDate.test.ts: [@cloudflare/wrangler]
  • packages/create-cloudflare/src/helpers/compatDate.ts: [@cloudflare/wrangler]
  • pnpm-lock.yaml: [@cloudflare/wrangler]

@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 15, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

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

@cloudflare/config

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

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 17faf17

@petebacondarwin

Copy link
Copy Markdown
Contributor

Was this already fixed by #15185?

@petebacondarwin

Copy link
Copy Markdown
Contributor

Closing as this has been resolved already.
Thanks for the PR @nithin42

@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Aug 16, 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 scaffolds a compatibility_date newer than the bundled workerd supports - new projects fail on first dev (regression of #1948)

3 participants