Skip to content

[wrangler] Condense repeated environment config warnings#13848

Open
MattieTK wants to merge 2 commits intomainfrom
fix/condense-env-config-warnings
Open

[wrangler] Condense repeated environment config warnings#13848
MattieTK wants to merge 2 commits intomainfrom
fix/condense-env-config-warnings

Conversation

@MattieTK
Copy link
Copy Markdown
Member

@MattieTK MattieTK commented May 7, 2026

Condense repeated Wrangler environment configuration warnings.

This updates config validation so repeated missing vars and define entries are summarised in one warning with a list of missing keys. It also avoids emitting the experimental unsafe warning twice when unsafe appears at both the top level and in the active environment.


  • 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 this only changes warning formatting.

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

@MattieTK MattieTK requested a review from workers-devprod as a code owner May 7, 2026 13:35
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

🦋 Changeset detected

Latest commit: 257f677

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 May 7, 2026
@workers-devprod workers-devprod requested review from a team and NuroDev and removed request for a team May 7, 2026 13:35
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented May 7, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

✅ All changesets look good

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented May 7, 2026

Everything looks correct. The changes are well-structured and all tests pass. Let me do a final summary of the review:

Summary of changes:

  1. validateVars: Condensed per-key warnings into a single warning with a bullet list of missing keys.
  2. validateDefines: Same condensation for define entries.
  3. unsafe experimental warning: Added a guard to skip the experimental warning for named environments when unsafe already exists at the top level (preventing a duplicate warning).
  4. Tests: Added a new test for the condensed vars warning, updated an existing define snapshot to match new format, and added BAR: "bar" to an existing test fixture.

The logic is correct, tests pass, and there are no issues I can identify. The changeset is properly scoped to wrangler as a patch.

LGTM

github run


- "env.staging" environment configuration
- The following vars exist at the top level, but not on "env.staging.vars".
This is not what you probably want, since "vars" configuration is not inherited by environments.
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.

"This is probably not what you want" is maybe a bit more idiomatic?

);

experimental(diagnostics, rawEnv, "unsafe");
if (topLevelEnv === undefined || rawConfig?.unsafe === undefined) {
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.

What's this for?

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 May 7, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 257f677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

3 participants