Skip to content

fix(workers-utils): validate optional D1 database binding fields - #14530

Merged
petebacondarwin merged 2 commits into
cloudflare:mainfrom
Partha-Shankar:fix/migration-audit
Jul 6, 2026
Merged

petebacondarwin merged 2 commits into
cloudflare:mainfrom
Partha-Shankar:fix/migration-audit

Conversation

@Partha-Shankar

@Partha-Shankar Partha-Shankar commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR adds missing type validation for optional D1 database binding configuration fields in @cloudflare/workers-utils.

Previously, the following optional fields were recognised by the validator but were not type-checked:

  • database_name
  • migrations_dir
  • migrations_table
  • database_internal_env

This change validates these fields as optional strings using the existing validation pattern, making D1 binding validation consistent with other binding types such as KV, R2, and Durable Objects.

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: internal validation fix with no user-facing behavior changes.

Open in Devin Review

…onfig fields

Add optional string validation checks for database_name, migrations_dir, migrations_table, and database_internal_env inside validateD1Binding. This aligns D1's validation behavior with other bindings (like KV, R2, and Durable Objects) that typecheck all optional parameters.
@changeset-bot

changeset-bot Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9f72fbc

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

This PR includes changesets to release 5 packages
Name Type
@cloudflare/workers-utils Patch
@cloudflare/autoconfig Patch
@cloudflare/cli-shared-helpers Patch
@cloudflare/deploy-helpers Patch
@cloudflare/workers-auth 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 Jul 3, 2026
@workers-devprod
workers-devprod requested review from a team and petebacondarwin and removed request for a team July 3, 2026 08:48
@workers-devprod

workers-devprod commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@pkg-pr-new

pkg-pr-new Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

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

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 9f72fbc

@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 bugs or issues to report.

Open in Devin Review

@petebacondarwin petebacondarwin 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.

Thanks for submitting this PR @Partha-Shankar - in order to land it we need a few additional items:

  • please update the PR description with the checkboxes from the PR template properly selected - this is a requirement to pass our PR description CI check
  • please add a changeset, with patch type, describing the change
  • please update the validation tests to check the changes you have made

@github-project-automation github-project-automation Bot moved this from Untriaged to In Review in workers-sdk Jul 3, 2026
@petebacondarwin
petebacondarwin marked this pull request as draft July 3, 2026 09:19
… database fields

Also add changeset for type validation of optional D1 configuration fields.
@Partha-Shankar

Partha-Shankar commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I've addressed the requested changes:

  • Updated the PR description.
  • Added a patch changeset for @cloudflare/workers-utils.
  • Expanded the regression tests to cover each newly validated optional D1 configuration field individually.

All checks are now passing.

@Partha-Shankar
Partha-Shankar marked this pull request as ready for review July 4, 2026 06:23

@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

@petebacondarwin
petebacondarwin merged commit aad35b7 into cloudflare:main Jul 6, 2026
59 of 60 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in workers-sdk Jul 6, 2026
colinhacks added a commit to colinhacks/workers-sdk that referenced this pull request Jul 8, 2026
Adding one entry to the recognised-package-manager list is additive,
same scale as the D1-bindings validation changeset (cloudflare#14530), not a
headline feature on the order of cloudflare#14474 (cache options for
WorkerEntrypoint exports) — patch fits workers-utils' own convention
better than minor.
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