Skip to content

Add regional and jurisdictional placement constraints#13571

Merged
petebacondarwin merged 15 commits intocloudflare:mainfrom
must108:ma/container-placement
Apr 17, 2026
Merged

Add regional and jurisdictional placement constraints#13571
petebacondarwin merged 15 commits intocloudflare:mainfrom
must108:ma/container-placement

Conversation

@must108
Copy link
Copy Markdown
Contributor

@must108 must108 commented Apr 16, 2026

Fixes #13570

This merge request adds support for constraints.regions and constraints.jurisdiction in the container configuration, allowing users to control where their containers run.

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
image
Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 16, 2026

🦋 Changeset detected

Latest commit: 609a434

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 16, 2026
@workers-devprod workers-devprod requested review from a team and penalosa and removed request for a team April 16, 2026 15:55
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 16, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/cloudchamber
  • ✅ @cloudflare/wrangler
Show detailed file reviewers

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

Open in Devin Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 16, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 5032f38

Copy link
Copy Markdown
Contributor

@emily-shen emily-shen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you be able to add a test to containers/deploy.test.ts as well?

Comment thread packages/workers-utils/src/config/environment.ts Outdated
Comment thread packages/workers-utils/src/config/validation.ts
@must108
Copy link
Copy Markdown
Contributor Author

must108 commented Apr 16, 2026

would you be able to add a test to containers/deploy.test.ts as well?

I added tests in validation.ts and normalize-and-validate-config.test.ts. Are these sufficient? With these tests, adding to deploy.test.ts would be redundant. I could remove the tests I wrote and add to deploy.test.ts if it is better.

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 found 1 new potential issue.

🐛 1 issue in files not directly in the diff

🐛 Jurisdiction validation is case-sensitive, rejecting valid uppercase input that normalization would handle (packages/workers-utils/src/config/validation.ts:3527-3528)

The jurisdiction validation in packages/workers-utils/src/config/validation.ts:3527-3528 checks !['eu', 'fedramp'].includes(constraints.jurisdiction) without lowercasing the input first. This means a user who writes jurisdiction = "EU" or jurisdiction = "FedRAMP" in their config will get a validation error. This is inconsistent with how regions is validated just below (validRegions.includes(region.toUpperCase()) at line 3549), which does case-insensitive comparison. The normalization code in packages/wrangler/src/containers/config.ts:118 calls .toLowerCase(), confirming case-insensitive input was intended. Since validation runs before normalization, any non-lowercase jurisdiction value will be rejected before it can be normalized. The test at packages/wrangler/src/__tests__/containers/config.test.ts:462 uses jurisdiction: "EU" and expects "eu" as output, but this only passes because the test bypasses validation via as Partial<Config> as Config.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment thread packages/workers-utils/src/config/environment.ts
Comment thread packages/workers-utils/src/config/validation.ts
devin-ai-integration[bot]

This comment was marked as resolved.

@emily-shen
Copy link
Copy Markdown
Contributor

would you be able to add a test to containers/deploy.test.ts as well?

I added tests in validation.ts and normalize-and-validate-config.test.ts. Are these sufficient? With these tests, adding to deploy.test.ts would be redundant. I could remove the tests I wrote and add to deploy.test.ts if it is better.

It's not entirely redundant (there is some overlap though) because deploy also tests these values get passed to the API as expected. you could probably just set some jurisdiction/region values in an existing test in deploy.test.ts and update a snapshot.

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 17, 2026
@must108
Copy link
Copy Markdown
Contributor Author

must108 commented Apr 17, 2026

would you be able to add a test to containers/deploy.test.ts as well?

I added tests in validation.ts and normalize-and-validate-config.test.ts. Are these sufficient? With these tests, adding to deploy.test.ts would be redundant. I could remove the tests I wrote and add to deploy.test.ts if it is better.

It's not entirely redundant (there is some overlap though) because deploy also tests these values get passed to the API as expected. you could probably just set some jurisdiction/region values in an existing test in deploy.test.ts and update a snapshot.

@emily-shen done!

@petebacondarwin petebacondarwin merged commit 7dc0433 into cloudflare:main Apr 17, 2026
55 of 57 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Apr 17, 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.

Containers: Support for regional and jurisdictional constraints

7 participants