Follow-up from PR #788 review panel -- cli-logging-expert finding #3, confirmed pre-existing and not introduced by #788.
Describe the bug
When a generic (non-GitHub, non-ADO) host fails during clone or git ls-remote, the error message drops the port on `dep_host`, so a user on Bitbucket Datacenter (or any self-hosted host using a custom port) sees:
For private repositories on bitbucket.corp.com, configure SSH keys or a git credential helper.
instead of:
For private repositories on bitbucket.corp.com:7999, configure SSH keys or a git credential helper.
The port is the whole reason they are here -- hiding it from the diagnostic defeats the purpose of the PR #788 port-threading work for this specific error path.
Affected call sites (current main, after #788/#789 merge)
Both do:
```python
host_name = dep_host or "the target host"
error_msg += (
f"For private repositories on {host_name}, configure SSH keys or a git credential helper. "
...
)
```
`dep_host` is pulled straight off the dependency and never gains `:{port}`.
To Reproduce
- Configure an `apm.yml` with a Bitbucket DC-style SSH URL on a non-default port, e.g.
`ssh://git@bitbucket.example.com:7999/team/repo.git`.
- Ensure credentials are missing or wrong so the clone fails.
- Run `apm install`.
- Observe the error message: `bitbucket.example.com` appears without the `:7999` suffix.
Expected behavior
Both error branches should render `{host}:{port}` when `dep_ref.port` is set -- using `host_info.display_name` from the `AuthResolver` path is the most consistent fix (it already handles the port-rendering convention used by the auth branch a few lines above at `:858`).
Suggested shape:
```python
host_info = self.auth_resolver.classify_host(dep_host, port=(dep_ref.port if dep_ref else None))
host_name = host_info.display_name if dep_host else "the target host"
```
Environment
- Not environment-dependent; any caller that hits the `is_generic` branch with `dep_ref.port` set reproduces.
Additional context
- The `AuthResolver.build_error_context` branch on the non-generic path already uses `host_info.display_name` (see `core/auth.py:374`), so aligning the generic branch closes the last internal asymmetry around port surfacing.
- Scope-limited fix: no new signatures, no schema impact; only the two `host_name = dep_host or ...` lines change.
Refs
Follow-up from PR #788 review panel -- cli-logging-expert finding #3, confirmed pre-existing and not introduced by #788.
Describe the bug
When a generic (non-GitHub, non-ADO) host fails during clone or
git ls-remote, the error message drops the port on `dep_host`, so a user on Bitbucket Datacenter (or any self-hosted host using a custom port) sees:instead of:
The port is the whole reason they are here -- hiding it from the diagnostic defeats the purpose of the PR #788 port-threading work for this specific error path.
Affected call sites (current main, after #788/#789 merge)
Both do:
```python
host_name = dep_host or "the target host"
error_msg += (
f"For private repositories on {host_name}, configure SSH keys or a git credential helper. "
...
)
```
`dep_host` is pulled straight off the dependency and never gains `:{port}`.
To Reproduce
`ssh://git@bitbucket.example.com:7999/team/repo.git`.
Expected behavior
Both error branches should render `{host}:{port}` when `dep_ref.port` is set -- using `host_info.display_name` from the `AuthResolver` path is the most consistent fix (it already handles the port-rendering convention used by the auth branch a few lines above at `:858`).
Suggested shape:
```python
host_info = self.auth_resolver.classify_host(dep_host, port=(dep_ref.port if dep_ref else None))
host_name = host_info.display_name if dep_host else "the target host"
```
Environment
Additional context
Refs