Skip to content

fix(sdk): decode URL-encoded segments in Azure DevOps remote parsing - #1637

Merged
bradygaster merged 2 commits into
github:devfrom
omercangumus:omercangumus/1526-ado-legacy-url-decode
Aug 23, 2026
Merged

bradygaster merged 2 commits into
github:devfrom
omercangumus:omercangumus/1526-ado-legacy-url-decode

Conversation

@omercangumus

Copy link
Copy Markdown
Contributor

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.proj came out with project: "Pref%20Proj" instead of "Pref Proj". That raw value flows straight into AzureDevOpsAdapter's --project arg, and az CLI doesn't decode its own arguments, so az 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.com parser specifically, but the same regex-capture-without-decode pattern exists in the dev.azure.com HTTPS branch too, so I fixed all three branches (dev.azure.com, SSH, legacy visualstudio.com) with one helper rather than patching just the one from the repro.

How

  • packages/squad-sdk/src/platform/detect.ts: added decodeSegment() (tries decodeURIComponent, 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 of parseAzureDevOpsRemote().

Testing

  • Added 2 cases to the existing parseAzureDevOpsRemote describe block in test/platform-adapter.test.ts: the exact %20 repro against the legacy visualstudio.com format, and the same against dev.azure.com.
  • npx vitest run test/platform-adapter.test.ts -t parseAzureDevOpsRemote — 19/19 pass.
  • Full-suite (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 clean dev: same failures, same normalizeToolsInConfig is not a function root cause (stale/missing dist/). None of the 31 failing files touch platform-adapter.test.ts or detect.ts.
  • Diff hygiene: git diff vs git diff -w identical, no whitespace-only hunks. detect.ts and the test file are CRLF in this repo; preserved that, only the new lines carry real content changes.

⚠️ Quick Check

  • Changeset added: .changeset/fix-1526-ado-legacy-url-decode.md (patch @bradygaster/squad-sdk)

PR Readiness Checklist

Branch & Commit

  • Branch created from dev
  • Branch is up to date with dev
  • Verified diff contains only intended changes
  • PR is not in draft mode
  • Commit history is clean (single commit)

Build & Test

  • npm test passes (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 internals

Changeset

  • Changeset added (sdk patch)

Docs

  • N/A — internal parsing fix, no public API signature change

Exports

  • N/A — no new export, parseAzureDevOpsRemote already exported from platform/detect

Breaking Changes

None. Same function signature and return shape; decoded values are strictly more correct than the previously-encoded ones.

Waivers

None.

Fixes github#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>
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 2a9f56d

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 3 item(s) to address before review

Status Check Details
❌ Single commit 2 commits — consider squashing before review
✅ 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 9 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.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #1637

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 3
Files added 1
Files modified 2
Files deleted 0
Modules touched 3

🎯 Risk Factors

  • 3 files changed (≤5 → LOW)
  • 3 modules touched (2-4 → MEDIUM)

📦 Modules Affected

root (1 file)
  • .changeset/fix-1526-ado-legacy-url-decode.md
squad-sdk (1 file)
  • packages/squad-sdk/src/platform/detect.ts
tests (1 file)
  • test/platform-adapter.test.ts

This report is generated automatically for every PR. See #733 for details.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Friendly nudge — this PR has had no activity for 9 days.

What needs attention:

  • 👀 No approving reviews yet. Request a review from a teammate.
  • ⬇️ 105 commits behind dev. Rebase to pick up latest changes.

If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows.
This is an automated check that runs on weekdays. It won't nudge the same PR more than once per week.

@bradygaster
bradygaster merged commit d1fc598 into github:dev Aug 23, 2026
16 checks passed
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.

Azure DevOps legacy remote parser does not decode URL-encoded project names (%20), causing az boards query failure

2 participants