fix(cli): address PR review warnings

- Skip known cloud LANGSMITH_ENDPOINT values so SaaS users' tracing
  env var doesn't hijack the deploy host URL
- Fix --image-uri help text to accurately describe build+push+deploy
  flow instead of claiming no build step
- Validate existing deployment source before PATCHing with
  --image-uri to give a clear error on incompatible deployments
- Move /api-host path strip before localhost check in
  _smith_dashboard_base_url so local self-hosted status URLs work
- Fix test_constructor_strips_trailing_slash to use base_url property
  instead of removed httpx base_url
- Apply ruff formatting
This commit is contained in:
l2and
2026-07-30 17:33:27 -07:00
parent a6fb26816d
commit 1fa604f694
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -1371,7 +1371,10 @@ def _create_host_backend_client(
langsmith_endpoint = env_vars.get("LANGSMITH_ENDPOINT") or os.environ.get(
"LANGSMITH_ENDPOINT"
)
if langsmith_endpoint and langsmith_endpoint.rstrip("/") not in _cloud_endpoints:
if (
langsmith_endpoint
and langsmith_endpoint.rstrip("/") not in _cloud_endpoints
):
from urllib.parse import urlparse as _urlparse
_p = _urlparse(langsmith_endpoint)
@@ -1818,9 +1821,7 @@ def _deploy_cmd(
existing = _call_host_backend_with_optional_tenant(
client, lambda c: c.get_deployment(deployment_id)
)
existing_source = (
existing.get("source") if isinstance(existing, dict) else None
)
existing_source = existing.get("source") if isinstance(existing, dict) else None
if existing_source and existing_source != "external_docker":
raise click.UsageError(
f"Deployment {deployment_id} was created with source "
@@ -25,7 +25,7 @@ def client(mock_transport):
def test_constructor_strips_trailing_slash():
c = HostBackendClient("https://api.example.com/", "key")
assert str(c._client.base_url) == "https://api.example.com"
assert c.base_url == "https://api.example.com"
def test_constructor_empty_url_raises():