feat: EU region URL validation + unit tests (continuation of #88)#96
Open
Abdeltoto wants to merge 4 commits into
Open
feat: EU region URL validation + unit tests (continuation of #88)#96Abdeltoto wants to merge 4 commits into
Abdeltoto wants to merge 4 commits into
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
URL-based tools (get_sheet_by_url, search_in_sheet_by_url, what_am_i_assigned_to_by_sheet_url) now detect whether the frontend URL points to the EU or US region and validate it against the configured SMARTSHEET_ENDPOINT. A region mismatch returns a clear, actionable error instead of an opaque auth failure. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ectApiRegion, validateRegionMatch) Adds 33 unit tests covering the three exported helpers introduced for EU region support: - parseSmartsheetUrl: US/EU detection, query strings, trailing path segments, case-insensitive hostnames, malformed URLs (return null), URL constructor fallback path. - detectApiRegion: canonical US/EU endpoints, generic .eu hostnames, malformed input fallback, case-insensitive matching. - regionLabel + validateRegionMatch: matching and mismatched pairs in both directions, asserts the diagnostic mentions both regions, the corrected SMARTSHEET_ENDPOINT, and that a region-specific token is required. All tests pass; total suite is 72/72. Made-with: Cursor
4 tasks
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.
👋 PR #2 of 3 from a Smartsheet power user (see #95 for context).
This PR is complementary to #88 by @is-isaac — it cherry-picks his 3 commits (attribution preserved as
Sisyphus <clio-agent@sisyphuslabs.ai>, the original commit author) and adds the missing piece blocking the merge: unit tests forurl-utils.ts.Why a separate PR rather than commenting on #88
PR #88 has been open since February with no reviewer activity, and several users in #87 / #92 are blocked by the same EU auth bug. Re-bundling the code with tests (resolved against current
main) gives reviewers a single clean PR to merge. If you'd rather pull just the test commit onto #88 directly, please feel free — happy either way.What's in here
mainalready resolved):feat: add URL utility with EU/US region detectionfix: add EU region validation to URL-based toolsdocs: add EU region endpoint to config examplestest(utils): add Jest coverage for url-utils— 33 unit tests:parseSmartsheetUrl: US/EU detection, query strings, trailing path segments, case-insensitive hostnames, malformed URLs returningnull, URL-constructor fallback path.detectApiRegion: canonical US/EU endpoints, generic.euhostnames, malformed input fallback, case-insensitive matching.regionLabel+validateRegionMatch: matching and mismatched pairs in both directions; asserts the diagnostic mentions both regions, suggests the correctedSMARTSHEET_ENDPOINT, and explains a region-specific token is required.Why this matters
Region mismatches between
SMARTSHEET_ENDPOINTand the URL passed toget_sheet_by_url/search_in_sheet_by_url/what_am_i_assigned_to_by_sheet_urlproduce silent 401s today. After this change:api.smartsheet.eu.regionis exposed asapi.regionso downstream tools can do their own validation.Test plan
npm test→ 72/72 passed (3 suites, +33 tests from this PR)npm run typecheck→ cleaneu→usandus→eumismatchesCloses the testing gap on #88. Refs #87, #92 (EU auth reports).