fix(sdk): decode URL-encoded segments in Azure DevOps remote parsing - #1637
Open
omercangumus wants to merge 1 commit into
Open
fix(sdk): decode URL-encoded segments in Azure DevOps remote parsing#1637omercangumus wants to merge 1 commit into
omercangumus wants to merge 1 commit into
Conversation
Fixes bradygaster#1526 parseAzureDevOpsRemote() passed org/project/repo straight out of the regex match without decoding percent-encoding, so a legacy visualstudio.com remote with a space in the project name (.../Pref%20Proj/_git/...) produced "Pref%20Proj" instead of "Pref Proj". az CLI doesn't decode its own arguments, so every az call built from that project name failed. Added decodeSegment() and applied it across all three supported URL formats, not just the legacy one from the repro. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ✅ | Single commit | 1 commit — clean history |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ✅ | Copilot threads resolved | No Copilot review threads |
| ❌ | CI passing | 8 check(s) still running |
Files Changed (3 files, +30 −3)
| File | +/− |
|---|---|
.changeset/fix-1526-ado-legacy-url-decode.md |
+5 −0 |
packages/squad-sdk/src/platform/detect.ts |
+15 −3 |
test/platform-adapter.test.ts |
+10 −0 |
Total: +30 −3
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
Contributor
🟡 Impact Analysis — PR #1637Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-sdk (1 file)
tests (1 file)
This report is generated automatically for every PR. See #733 for details. |
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.
What
parseAzureDevOpsRemote()now decodes percent-encoded org/project/repo segments pulled out of a git remote URL.Why
Closes #1526
Repro from the issue:
https://mycomp.visualstudio.com/Pref%20Proj/_git/pref.projcame out withproject: "Pref%20Proj"instead of"Pref Proj". That raw value flows straight intoAzureDevOpsAdapter's--projectarg, andazCLI doesn't decode its own arguments, soaz repos pr list --project Pref%20Proj ...fails outright for any ADO project with a space (or other encoded char) in its name.Issue title calls out the legacy
visualstudio.comparser specifically, but the same regex-capture-without-decode pattern exists in thedev.azure.comHTTPS branch too, so I fixed all three branches (dev.azure.com, SSH, legacyvisualstudio.com) with one helper rather than patching just the one from the repro.How
packages/squad-sdk/src/platform/detect.ts: addeddecodeSegment()(triesdecodeURIComponent, falls back to the raw value if it's not validly percent-encoded) and applied it to the org/project/repo captures in all three regex branches ofparseAzureDevOpsRemote().Testing
parseAzureDevOpsRemotedescribe block intest/platform-adapter.test.ts: the exact%20repro against the legacyvisualstudio.comformat, and the same againstdev.azure.com.npx vitest run test/platform-adapter.test.ts -t parseAzureDevOpsRemote— 19/19 pass.npx vitest run) has 135 pre-existing failures on this Windows box unrelated to this change — confirmed by stashing this diff and re-running a subset (tool-name-normalization,sdk-real-session,health) against cleandev: same failures, samenormalizeToolsInConfig is not a functionroot cause (stale/missingdist/). None of the 31 failing files touchplatform-adapter.test.tsordetect.ts.git diffvsgit diff -widentical, no whitespace-only hunks.detect.tsand the test file are CRLF in this repo; preserved that, only the new lines carry real content changes..changeset/fix-1526-ado-legacy-url-decode.md(patch@bradygaster/squad-sdk)PR Readiness Checklist
Branch & Commit
devdevBuild & Test
npm testpasses (targeted suite 19/19; full-suite state on this Windows box pre-existing and unrelated, see Testing above)npm run lint— not run standalone, no type surface changed beyond the existing exported function's internalsChangeset
Docs
Exports
parseAzureDevOpsRemotealready exported fromplatform/detectBreaking Changes
None. Same function signature and return shape; decoded values are strictly more correct than the previously-encoded ones.
Waivers
None.