Skip to content

fix: parse remote authority from right#944

Merged
EhabY merged 5 commits into
mainfrom
fix/parse-remote-authority-safe-host
May 12, 2026
Merged

fix: parse remote authority from right#944
EhabY merged 5 commits into
mainfrom
fix/parse-remote-authority-safe-host

Conversation

@EhabY
Copy link
Copy Markdown
Collaborator

@EhabY EhabY commented May 7, 2026

Closes #937.

Summary

  • Parse Coder remote authorities from the right, rejoining all safeHost segments before username/workspace extraction.
  • Drop legacy empty-safeHost and --agent parser expectations; add double-dash/triple-dash safeHost regressions.
  • Remove empty-hostname fallbacks in path/secrets/SSH config helpers and avoid session lookup when no deployment is selected.

Tests

  • pnpm test:extension ./test/unit/util.test.ts ./test/unit/core/pathResolver.test.ts ./test/unit/remote/sshConfig.test.ts
  • pnpm typecheck
  • pnpm lint
  • pnpm test:extension
  • pnpm format:check
Implementation notes (Coder Agents generated)
  • parseRemoteAuthority now requires coder-vscode.<safeHost> and at least username/workspace fields.
  • The parser treats the last -- segment as workspace/agent, the previous segment as username, and rejoins earlier segments as safeHost.
  • Tests cover Latin double-dash safeHost, triple-dash Punycode-like safeHost, and multiple embedded -- segments.
  • Legacy deployment-unaware helpers and tests were removed per issue scope.

Generated by Coder Agents.

@EhabY EhabY self-assigned this May 7, 2026
@EhabY EhabY requested a review from code-asher May 7, 2026 16:35
@EhabY EhabY force-pushed the fix/parse-remote-authority-safe-host branch 2 times, most recently from 7193197 to b97c6e2 Compare May 11, 2026 13:27
@EhabY EhabY force-pushed the fix/parse-remote-authority-safe-host branch from b97c6e2 to 351582c Compare May 12, 2026 09:35
Copy link
Copy Markdown
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

wonderful

Comment thread src/util.ts
Comment thread src/util.ts
Comment thread src/util.ts
Comment thread src/util.ts Outdated
- Combine authority/host-name format docs into the function docstring.
- Use shorthand property names in the returned AuthorityParts.
- Drop the over-strict empty-segment check; only fail when the safe
  hostname, username, or workspace/agent segment is empty so domains
  like foo---------------bar.com remain valid.
- Add a regression test covering a safe hostname with many consecutive
  dashes.
@EhabY EhabY merged commit 96f9fee into main May 12, 2026
13 checks passed
@EhabY EhabY deleted the fix/parse-remote-authority-safe-host branch May 12, 2026 18:58
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.

parseRemoteAuthority: parse right-to-left to handle all safeHost shapes uniformly

2 participants