fix(install): surface custom port in generic host clone/ls-remote error#804
Open
edenfunf wants to merge 1 commit intomicrosoft:mainfrom
Open
fix(install): surface custom port in generic host clone/ls-remote error#804edenfunf wants to merge 1 commit intomicrosoft:mainfrom
edenfunf wants to merge 1 commit intomicrosoft:mainfrom
Conversation
The two is_generic error branches in github_downloader rendered the
bare host, dropping ``:{port}`` from the ``"For private repositories
on {host}"`` hint. Users on Bitbucket Datacenter (or any self-hosted
host using a non-default port) saw a diagnostic that hid the very
detail they needed to verify their git credential helper against.
Route both branches through ``AuthResolver.classify_host(...).display_name``
so the generic path shares port rendering with the adjacent ADO and
auth branches (which already used ``build_error_context`` ->
``host_info.display_name``). Keep the ``"the target host"`` fallback
for the (unreachable-today but defensive) ``dep_host=None`` case, and
mirror the ``dep_ref.port if dep_ref else None`` guard used at the
neighbouring call sites.
Scope-limited: no new signatures, no schema impact; only the two
``host_name = dep_host or "..."`` lines change.
Regression tests in tests/unit/test_generic_host_error_port.py cover
both call sites with ssh/https custom port and a no-port control.
Closes microsoft#798
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.
Description
The two
is_genericerror branches ingithub_downloaderrender the bare host in the"For private repositories on {host}"hint, dropping any custom port. Users on Bitbucket Datacenter (or any self-hosted host on a non-default port) see a diagnostic that hides the very detail they need to verify their git credential helper against:instead of:
Both branches now route through
AuthResolver.classify_host(...).display_name, so the generic path shares port rendering with the adjacent ADO and auth branches (which already usedbuild_error_context→host_info.display_name). This also means any future refinement toHostInfo.display_name(e.g. default-port normalisation, tracked in #797) propagates to these two call sites for free.Scope-limited per the issue: no new signatures, no schema impact; only the two
host_name = dep_host or "..."lines change. The"the target host"fallback is kept for the (unreachable-today but defensive)dep_host=Nonecase, mirroring thedep_ref.port if dep_ref else Noneguard already used at the neighbouring auth call sites.Fixes #798
Type of change
Testing
New regression tests in
tests/unit/test_generic_host_error_port.pycover both error branches with three shapes each: ssh custom port (Bitbucket DC 7999), https custom port (Bitbucket DC 7990), and a no-port control that guards against spurious:suffixes. Temporarily reverting the fix turns the four port-bearing assertions red with the exact bare-host string described in the issue, then green again once the fix is reapplied -- the tests bite on the regression they're named after.Manual verification with
ssh://git@bitbucket.nonexistent-host.example:7999/team/repo.git:pytest tests/unit -q→ 4449 passed, 0 new failures. The three pre-existing failures intests/test_github_downloader.pyreproduce onorigin/mainwithout this patch and are unrelated.