feat: add gateway client with env-driven assembly

Includes config aggregation for multi-source env keys, from_env and
from_settings factories with explicit shared-backend injection,
gather_bounded, top-level exports, tightened import-linter layers with
the gate removed from the Makefile, and the finalized .env.example.
This commit is contained in:
2026-07-20 07:47:05 -04:00
parent 936895919c
commit 7b9815f4bc
30 changed files with 1701 additions and 253 deletions
+9 -3
View File
@@ -34,7 +34,9 @@ class TestBaseShape:
class TestResultInvalid:
def test_carries_diagnosis(self):
exc = ResultInvalidError(
"bad json", raw_text="{oops", repair_error="unterminated",
"bad json",
raw_text="{oops",
repair_error="unterminated",
validation_errors=("field x missing",),
)
assert exc.raw_text == "{oops"
@@ -45,7 +47,9 @@ class TestResultInvalid:
class TestGatewayUnavailable:
def test_fields_and_inheritance(self):
exc = AllSourcesExhausted(
scope="LLM", reason="retry_exhausted", retry_after_s=4.0,
scope="LLM",
reason="retry_exhausted",
retry_after_s=4.0,
per_source_reasons={"qwen_1": "timeout"},
)
assert isinstance(exc, GatewayUnavailableError)
@@ -66,7 +70,9 @@ class TestGatewayUnavailable:
def test_per_source_reason_domain_enforced(self):
with pytest.raises(ValueError):
AllSourcesExhausted(
scope="LLM", reason="no_sources", retry_after_s=0.0,
scope="LLM",
reason="no_sources",
retry_after_s=0.0,
per_source_reasons={"qwen_1": "weird"},
)