Skip to content

[wrangler] Use formatConfigSnippet for compatibility_date warning in dev#13205

Merged
petebacondarwin merged 2 commits intomainfrom
pbacondarwin/use-formatConfigSnippet-in-ConfigController
Apr 5, 2026
Merged

[wrangler] Use formatConfigSnippet for compatibility_date warning in dev#13205
petebacondarwin merged 2 commits intomainfrom
pbacondarwin/use-formatConfigSnippet-in-ConfigController

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin commented Apr 1, 2026

Use formatConfigSnippet so the compatibility_date warning in wrangler dev renders correctly for both TOML and JSON config files.

The getDevCompatibilityDate() function in ConfigController.ts warns when no compatibility_date is set and suggests adding one to the config file. The suggestion was hardcoded in TOML format (compatibility_date = "..."), which is incorrect when the user's config is wrangler.json or wrangler.jsonc.

This replaces the hardcoded TOML snippet with formatConfigSnippet(), which already exists in @cloudflare/workers-utils and is used elsewhere (e.g. deploy.ts, match-tag.ts) for exactly this purpose.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: existing test for this warning uses TOML config and continues to pass; the change uses a well-tested utility function
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this is an internal message format fix

Open with Devin

The compatibility_date warning in getDevCompatibilityDate() hardcoded a
TOML-format snippet. Use formatConfigSnippet() instead so the snippet
renders correctly for both wrangler.toml and wrangler.json configs.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 1, 2026

🦋 Changeset detected

Latest commit: a22948f

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

@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Apr 1, 2026
@workers-devprod workers-devprod requested a review from a team April 1, 2026 19:18
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 1, 2026

UnknownError: ProviderInitError

github run

@workers-devprod workers-devprod requested review from edmundhung and removed request for a team April 1, 2026 19:18
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 1, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 1, 2026

@petebacondarwin Bonk workflow failed. Check the logs for details.

View workflow run · To retry, trigger Bonk again.

Copy link
Copy Markdown
Contributor

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

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 2 additional findings.

Open in Devin Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 1, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: a22948f

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

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 Apr 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

✅ All changesets look good

Review Summary:

The changeset .changeset/use-formatConfigSnippet-in-dev-compat-date.md meets all guidelines:

  1. Version Type: patch is appropriate — this is a bug fix/improvement to ensure warning messages match the user's config file format (TOML vs JSON).

  2. Changelog Quality: Clear description explaining:

    • What changed: Uses formatConfigSnippet instead of hardcoded TOML
    • Why: To render the snippet in the correct format based on user's config file type
  3. Markdown Headers: No h1/h2/h3 headers present ✓

  4. Analytics: No analytics collection mentioned

  5. Dependabot: Not a dependency update changeset

  6. Experimental features: Not applicable

@petebacondarwin petebacondarwin added this pull request to the merge queue Apr 5, 2026
Merged via the queue into main with commit 6fa5dfd Apr 5, 2026
51 checks passed
@petebacondarwin petebacondarwin deleted the pbacondarwin/use-formatConfigSnippet-in-ConfigController branch April 5, 2026 16:08
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Apr 5, 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