Allow adding regions to existing namespaces - #402
Open
adityavad wants to merge 4 commits into
Open
Conversation
|
|
Replace the blanket "regions cannot be changed" error with a more nuanced check that allows region additions while still blocking removals and replacements. This enables users to add a second region to enable multi-region namespaces (MRN) via Terraform without recreating the namespace. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
adityavad
force-pushed
the
adityav/allow-region-addition
branch
from
February 13, 2026 21:38
254535a to
cb5b754
Compare
…ions UpdateNamespace now receives the current region list (preserving order) instead of the planned list, preventing accidental active-region migration from list reordering. Region additions are performed via separate AddNamespaceRegion API calls after the main update completes. Adds unit tests for getAddedRegions (4 cases) and getRegionUpdatePlan (6 cases) covering safe add, reorder handling, removal blocking, and replacement detection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Refactor region update logic into a testable updateNamespaceWithRegions function behind a namespaceRegionUpdateClient interface. Add schema-level region count validation (1-2 entries) and a sentinel error for blocked removals. Replace old TestAreRegionsEqual/TestIsRegionRemoval with TestGetRegionUpdatePlan covering all cases, and add fake-client tests for the full update+add sequence and early removal blocking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
adityavad
force-pushed
the
adityav/allow-region-addition
branch
from
February 13, 2026 23:12
04e150b to
6be284a
Compare
When the only change is adding a region, UpdateNamespace receives a spec identical to the current state (since we preserve currentRegions) and returns InvalidArgument "nothing to change". Detect this case and skip to AddNamespaceRegion instead of failing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
adityavad
marked this pull request as ready for review
February 17, 2026 20:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Allow adding regions to an existing namespace via Terraform, enabling multi-region namespaces (MRN) without recreating the namespace. Region removals and replacements remain blocked for safety.
Closes #401
Changes
areRegionsEqual(which blocked all region changes) withclassifyRegionChanges, which distinguishes additions from removals — additions are allowed, removals/replacements are blockedupdateNamespaceWithRegionsfunction behind anamespaceRegionUpdateClientinterfaceAddNamespaceRegionfor region additions instead of passing planned region order throughUpdateNamespaceUpdateNamespacecalls to avoid accidental failover from list reorderingInvalidArgument"nothing to change" fromUpdateNamespacewhen the only change is a region addition — skip toAddNamespaceRegioninstead of failingSizeBetween(1, 2))Testing
classifyRegionChanges(6 cases: no-change, reorder, addition, prepend, replacement, removal)updateNamespaceWithRegionsusing a fake client (region addition sequence, removal blocking before API calls, "nothing to change" skip-to-add scenario)Before change:


After change:
Checklist