diff --git a/src/gpu_index/common/http.py b/src/gpu_index/common/http.py index c82f8e4..b56325d 100644 --- a/src/gpu_index/common/http.py +++ b/src/gpu_index/common/http.py @@ -22,14 +22,11 @@ from contextlib import contextmanager from typing import Iterator, Optional -# One identity across every repository that collects for this index. The -# +URL is getcomputable.com and NOT this repository: a repo URL stops -# resolving if the repo is renamed or made private, and a 404 is no better -# than no contact at all. -UA = ( - "CGI-Collector/1.0 (+https://getcomputable.com; " - "team@getcomputable.com)" -) +# The User-Agent sent with every request: a neutral product token, not a +# library default and not a browser string. An operator running this code +# under their own identity can install a different value for a scope with +# user_agent_scope(). +UA = "gpu-index/1.0" _USER_AGENT_OVERRIDE: contextvars.ContextVar[Optional[str]] = contextvars.ContextVar( "gpu_index_user_agent_override", default=None ) diff --git a/tests/unit/test_public_read_backend.py b/tests/unit/test_public_read_backend.py index e554071..135c4f1 100644 --- a/tests/unit/test_public_read_backend.py +++ b/tests/unit/test_public_read_backend.py @@ -72,7 +72,7 @@ def test_from_env_without_public_url_keeps_local_default(tmp_path): # ------------------------------------------------------- get-object reads -def test_get_bytes_returns_body_with_cgi_user_agent(): +def test_get_bytes_returns_body_with_collector_user_agent(): seen = {} def handler(request: httpx.Request) -> httpx.Response: @@ -87,10 +87,7 @@ def handler(request: httpx.Request) -> httpx.Response: f"{BASE_URL}/index/basket/composites/m1/2026-08-16.json" ) assert seen["ua"] == UA - assert "CGI-Collector/" in seen["ua"] - # No browser prefix: the UA is a public identity, and the bot - # protection on the collected hosts screens an unidentified client, - # not the absence of a browser string. + # The token claims no browser. assert not seen["ua"].lower().startswith("mozilla/")