Skip to content

Multi region auto switching support#43

Merged
Thor963 merged 15 commits into
mainfrom
alpha
Jun 7, 2026
Merged

Multi region auto switching support#43
Thor963 merged 15 commits into
mainfrom
alpha

Conversation

@Thor963

@Thor963 Thor963 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Adds multi-region support to the Stallion CLI so that customers in different regions (currently ap and us) hit the correct regional API host instead of the global api.stalliontech.io URL.

@stalliondevx stalliondevx Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 StallionDevX AI Review

Quality Score: ░░░░░░░░░░ 0/100

Verdict: comment

Summary

⚠️ Automated review could not be completed. The AI analysis encountered an error. Please review this PR manually.

@stalliondevx stalliondevx Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 StallionDevX AI Review

Quality Score: ░░░░░░░░░░ 0/100

Verdict: comment

Summary

⚠️ Automated review could not be completed. The AI analysis encountered an error. Please review this PR manually.

@sherlock-stallion sherlock-stallion self-requested a review June 7, 2026 17:54

@stalliondevx stalliondevx Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 StallionDevX AI Review

Quality Score: █████████░ 90/100

Verdict: request changes

Summary

The pull request introduces multi-region support, which is a significant and well-implemented feature. The logic for resolving regions based on CI tokens or API calls is sound. There are minor issues related to error handling, hardcoded domain, and changelog dates.

⚠️ Warning (3)

  • 📝 Incorrect Dates in ChangelogCHANGELOG.md:2
    The dates in the CHANGELOG.md file (e.g., 2026-06-06, 2026-02-13) are in the future, which is likely a copy-paste error or placeholder. This should reflect the actual release dates.
  • 🧹 Hardcoded Domain in API Base URLsrc/utils/common.ts:8
    The domain 'stalliontech.io' is hardcoded within the getApiBaseUrl function. This reduces flexibility for different environments (e.g., staging, development) where the base domain might differ.
  • 🐛 Generic Error Message in resolveRegionsrc/utils/region.ts:38
    The catch block in resolveRegion throws a generic 'Something went wrong' error. This hides the original error context, making debugging difficult when an issue occurs during region resolution.

Comment thread CHANGELOG.md
Comment thread src/utils/common.ts
Comment thread src/utils/region.ts

@stalliondevx stalliondevx Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 StallionDevX AI Review

Quality Score: ████████░░ 75/100

Verdict: request changes

🔐 Security vulnerabilities detected — review required before merging

Summary

The pull request introduces multi-region support by refactoring API base URL resolution and adding utilities for parsing region from tokens and resolving it via an API call. This is a significant improvement for scalability and user experience. However, some areas need attention regarding robustness, error handling, and potential security implications of input parameters.

⚠️ Warning (4)

  • 🧹 Brittle Token Format Assumptionsrc/utils/region.ts:8
    The parseTokenRegion function relies on a very specific hardcoded token format (length 43, underscore at index 6). If the token format changes in the future, this parsing logic will break, leading to unexpected behavior.
  • 🐛 Generic Error Handling in Region Resolutionsrc/utils/region.ts:19
    The resolveRegion function catches all errors and throws a generic 'Something went wrong' message. This hides the actual underlying error, making debugging difficult and obscuring the root cause of failures in production.
  • 🔐 Unsanitized uploadPath in API Callsrc/utils/region.ts:29
    The uploadPath is sent directly to the GET_ORG_REGION endpoint. If uploadPath is user-controlled and the backend processes it without proper sanitization, it could potentially be exploited for path traversal or other injection attacks on the server-side.
  • 🧹 Hardcoded Regions Listsrc/utils/region.ts:3
    The REGIONS array is hardcoded. If new regions are introduced, this list will need manual updates, which can be easily overlooked and lead to inconsistencies or errors in region validation.

Comment thread src/utils/region.ts
Comment thread src/utils/region.ts
Comment thread src/utils/region.ts
Comment thread src/utils/region.ts
@Thor963 Thor963 changed the title Alpha Multi region auto switching support Jun 7, 2026
@Thor963 Thor963 merged commit 0ab4809 into main Jun 7, 2026
5 checks passed
@stallion-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 2.5.0-alpha.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@stallion-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 2.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants