From 3185f735724cfac4f820233ef58eeac53a9bdc85 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 30 Oct 2026 18:30:20 -0700 Subject: [PATCH] test(e2e): freeze the packument map and note the rate limiter self-test --- tests/e2e/claude_code/cli_driver.py | 5 +++-- tests/e2e/cli_harness/npm_version_resolver.py | 3 ++- tests/e2e_harness/AGENTS.md | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/e2e/claude_code/cli_driver.py b/tests/e2e/claude_code/cli_driver.py index 0d16c28e343..599cfe6aa75 100644 --- a/tests/e2e/claude_code/cli_driver.py +++ b/tests/e2e/claude_code/cli_driver.py @@ -22,7 +22,7 @@ import tempfile import time from concurrent.futures import ThreadPoolExecutor, as_completed from dataclasses import dataclass, field -from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, Final, List, Mapping, Optional, Sequence, Tuple, Union from cli_harness.lockdown import isolated_home, locked_down_env from cli_harness.rate_limiter import RateBucket, RateLimiter, get_default_limiter @@ -72,6 +72,7 @@ Anthropic / Bedrock / Vertex) to reset. Both knobs are env-tunable so a matrix run can trade wall time for resilience without code edits; retries=0 disables the behavior entirely.""" + def infer_provider(model: str) -> RateBucket: """Map a model alias to its compat-matrix rate bucket. @@ -85,7 +86,7 @@ def infer_provider(model: str) -> RateBucket: """ if not model: raise ValueError("model must be a non-empty string") - lower = model.lower() + lower: Final = model.lower() if lower.endswith("-azure-openai"): return RateBucket.AZURE_OPENAI if lower.endswith("-openai"): diff --git a/tests/e2e/cli_harness/npm_version_resolver.py b/tests/e2e/cli_harness/npm_version_resolver.py index d388bfe0134..3c3f9b89ce5 100644 --- a/tests/e2e/cli_harness/npm_version_resolver.py +++ b/tests/e2e/cli_harness/npm_version_resolver.py @@ -16,6 +16,7 @@ import urllib.request from collections.abc import Mapping from dataclasses import dataclass from datetime import datetime, timedelta, timezone +from types import MappingProxyType from typing import BinaryIO, Final, cast MIN_AGE: Final = timedelta(days=3) @@ -33,7 +34,7 @@ class Packument: document: Final = _as_mapping(raw) times: Final = _as_mapping(document.get("time")) return cls( - published_at={version: _parse_utc(stamp) for version, stamp in _string_values(times)}, + published_at=MappingProxyType({version: _parse_utc(stamp) for version, stamp in _string_values(times)}), versions=frozenset(_as_mapping(document.get("versions"))), ) diff --git a/tests/e2e_harness/AGENTS.md b/tests/e2e_harness/AGENTS.md index 740218276d3..8528424166c 100644 --- a/tests/e2e_harness/AGENTS.md +++ b/tests/e2e_harness/AGENTS.md @@ -2,7 +2,7 @@ Tests of the harness under `tests/e2e/` (the transport, the clients, the fixture bundle and replay edge, the stack lock, the IdP launcher, the coverage collector, the JUnit properties and the Claude Code driver), not of the product. They live outside `tests/e2e/` because the Buildkite e2e run copies that folder into the runner image and runs every test in it, so a harness test in there counts as a product test in the nightly numbers. Nothing here needs a proxy, provider keys or the network -The layout mirrors `tests/e2e/`: `test_e2e_http.py` covers `tests/e2e/e2e_http.py`, `logging/test_datadog_reader.py` covers `tests/e2e/logging/datadog_reader.py`, `claude_code/` covers the driver, builder and probe, and `cli_harness/` covers the version resolver and the CLI env lockdown. Put a new harness test under the folder that mirrors the suite folder whose module it covers +The layout mirrors `tests/e2e/`: `test_e2e_http.py` covers `tests/e2e/e2e_http.py`, `logging/test_datadog_reader.py` covers `tests/e2e/logging/datadog_reader.py`, `claude_code/` covers the driver, builder and probe, and `cli_harness/` covers the version resolver, the CLI env lockdown and the rate limiter. Put a new harness test under the folder that mirrors the suite folder whose module it covers Run them from the repo root. `e2e_config` reads `LITELLM_MASTER_KEY` at import and any value will do, the CI lane sets a dummy: