Skip to content

Conversation

@manisha1997
Copy link
Contributor

@manisha1997 manisha1997 commented Nov 25, 2025

Fixes

Set Deprecation warning for edge
Screenshot 2025-11-25 at 10 00 37 PM

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to introduce regional API domain processing by adding a region_mappings dictionary and deprecating the edge parameter in favor of region. However, the implementation has several critical issues that will break existing functionality and violate the documented API contract.

Key changes attempted:

  • Added region_mappings dictionary to map region codes (e.g., "au1") to edge names (e.g., "sydney")
  • Added deprecation warning for the edge parameter
  • Modified edge initialization logic to automatically derive edge from region
  • Added test for deprecation warning
  • Updated test cases to use mapped region values

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
twilio/base/client_base.py Adds region-to-edge mapping dictionary, deprecation warning for edge parameter, and modified initialization logic (contains critical bugs)
tests/unit/rest/test_client.py Adds deprecation warning test and updates test values to use region codes (contains unused import)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"`edge` is deprecated and will be removed in a future version. Use `region` instead.",
DeprecationWarning
)
self.edge = (self.region_mappings[region] if region is not None else "") or edge or environment.get("TWILIO_EDGE")
Copy link
Contributor

Choose a reason for hiding this comment

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

If region and edge both are provided, it will default to the edge specified in our mapping. Instead, it should give priority to the edge provided by the customer

manisha1997 and others added 4 commits November 28, 2025 12:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@tiwarishubham635 tiwarishubham635 left a comment

Choose a reason for hiding this comment

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

LGTM!

@sonarqubecloud
Copy link

@manisha1997 manisha1997 merged commit fbec376 into main Nov 28, 2025
19 checks passed
@manisha1997 manisha1997 deleted the regional-api-domain-processing branch November 28, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants