Skip to content

Add regional and jurisdictional placement constraints - #13571

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

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

Conversation

@must108

@must108 must108 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

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

changeset-bot Bot commented Apr 16, 2026

Copy link
Copy Markdown

🦋 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

workers-devprod commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

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

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

View in Devin Review to see 3 additional findings.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Apr 16, 2026

Copy link
Copy Markdown
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

@emily-shen emily-shen 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.

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

must108 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

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.

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

@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

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Apr 17, 2026
@must108

must108 commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

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