fix(connector): treat aliyun hk sms numbers as overseas#9111
Conversation
COMPARE TO
|
| Name | Diff |
|---|---|
| .changeset/fix-aliyun-hk-phone.md | 📈 +116 Bytes |
| packages/connectors/connector-aliyun-sms/src/index.test.ts | 📈 +338 Bytes |
| packages/connectors/connector-aliyun-sms/src/utils.test.ts | 📈 +154 Bytes |
| packages/connectors/connector-aliyun-sms/src/utils.ts | 📈 +199 Bytes |
There was a problem hiding this comment.
Pull request overview
This pull request fixes Aliyun SMS connector region detection so that bare 11-digit phone numbers are no longer universally treated as mainland China, preventing Hong Kong numbers like 85268326366 from being incorrectly routed to the China template.
Changes:
- Refined China-number detection to match mainland mobile number shape (
1+ 10 digits) with optional China region code (+86/86/0086). - Added unit coverage for the reported Hong Kong number at both helper-level (
isChinaNumber) and connector-level (template selection). - Added a patch changeset for
@logto/connector-aliyun-sms.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/connectors/connector-aliyun-sms/src/utils.ts | Tightens China phone number regex logic to mainland mobile-number shape with optional/required region code based on strictness. |
| packages/connectors/connector-aliyun-sms/src/utils.test.ts | Adds test coverage ensuring Hong Kong number 85268326366 is not considered China in both strict and non-strict modes. |
| packages/connectors/connector-aliyun-sms/src/index.test.ts | Verifies connector uses the overseas template code for 85268326366. |
| .changeset/fix-aliyun-hk-phone.md | Publishes the fix as a patch changeset for the Aliyun SMS connector package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@sjh9714 please check the failed integration tests |
|
I checked the failed integration jobs. The failures appear outside this connector change:\n\n- |
Summary
Fixes #5889.
The Aliyun SMS connector treated any bare 11-digit phone number as a mainland China number in non-strict mode. This keeps backward-compatible bare mainland mobile numbers (
1+ 10 digits), while routing Hong Kong numbers such as85268326366to the overseas template.Changes
Testing
Unit tests
corepack pnpm@10.33.4 --dir packages/connectors/connector-aliyun-sms testVerification
corepack pnpm@10.33.4 install --frozen-lockfilepnpm prepackcorepack pnpm@10.33.4 --dir packages/connectors/connector-aliyun-sms lintcorepack pnpm@10.33.4 --dir packages/connectors/connector-aliyun-sms check