workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

workers-utils - `getLatestWorkerdCompatibilityDate`

Open dario-piotrowicz opened this issue 4 weeks ago • 1 comments

Fixes https://jira.cfdata.org/browse/DEVX-2384

Add a new getLatestWorkerdCompatibilityDate function to the workers-utils package and use that package in wrangler, create-cloudflare and the vite plugin instead of having the two different implementations (getDevCompatibilityDate and getWorkerdCompatibilityDate).

Note: these changes get rid of the logic in getWorkerdCompatibilityDate that fetched workerd from the npm registry since that doesn't generally seem necessary/beneficial and just relying on the local version of workerd (which is always installed when the function is called) seem just faster and safer to me.


  • Tests
    • [x] Tests included/updated
    • [ ] Tests not necessary because:
  • Public documentation
    • [ ] Cloudflare docs PR(s):
    • [x] Documentation not necessary because: we don't currently document the workers-utils package
  • Wrangler V3 Backport
    • [ ] Wrangler PR:
    • [x] Not necessary because: not just a Wrangler change

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

dario-piotrowicz avatar Dec 11 '25 16:12 dario-piotrowicz

🦋 Changeset detected

Latest commit: c5d7016b01ea6acc10650ac44fdc2dd42e7bdaad

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

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

changeset-bot[bot] avatar Dec 11 '25 16:12 changeset-bot[bot]

See the inline comment for my concerns.

Would it make sense to:

  1. Refactor/move the code in a first PR (same API, same behavior)
  2. Change the behavior in a follow up PR only if we are certain there is no unwanted side effects

Once the function has been created/moved to workers-utils updating it would in theory be a breaking change (even though the package is still at 0.x so possibly not a huge deal), so I think it'd be ideal to just move it there once with the final implementation.

If your concern is C3 I can just leave C3 alone and just use the function is autoconfig (that wouldn't change any behavior at all). Although I'd still like to understand the C3 concern... because I fail to see downsides of this approach...

dario-piotrowicz avatar Dec 15 '25 10:12 dario-piotrowicz

Claude finished @dario-piotrowicz's task —— View job


Changeset Review

Reviewing changeset files for compliance with repository guidelines...

Tasks

  • [x] Read changeset guidelines
  • [x] Review .changeset/chubby-tigers-read.md
  • [x] Review .changeset/shaky-crews-brush.md
  • [x] Validate version types and changelog quality
  • [x] Check for cute animal image

All changesets look good

Both changeset files follow the repository guidelines:

  • Version types: Both use minor which is appropriate for new features/utilities
  • No forbidden major versions: No major version bumps for wrangler
  • Markdown headers: No h1/h2/h3 headers present
  • Descriptions: Clear, concise titles describing the new utilities being exposed

Changeset Details:

  1. chubby-tigers-read.md: Exposes getLocalWorkerdCompatibilityDate utility in workers-utils and vite-plugin
  2. shaky-crews-brush.md: Exposes isCompatDate utility in workers-utils

Both are appropriately marked as minor since they expose new public APIs.


Cute Animal Report: This appears to be Claude Code's loading spinner (an orange dot). Not technically a cute animal, but it gets a solid 10/10 for faithfully indicating work in progress and being perfectly circular. Would spin again.

claude[bot] avatar Dec 19 '25 14:12 claude[bot]

create-cloudflare

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

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

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

npm i https://pkg.pr.new/@cloudflare/pages-shared@11620
@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@11620
@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@11620
@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11620
@cloudflare/workers-editor-shared

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

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

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

commit: c5d7016

pkg-pr-new[bot] avatar Dec 19 '25 14:12 pkg-pr-new[bot]

Merging just not to leave this one hanging, we can always improve things later if we want 🙂

dario-piotrowicz avatar Dec 19 '25 18:12 dario-piotrowicz