fix(s41): pass required credential in AzureFoundryBackend.create_chat_client

This commit is contained in:
Kjell Tore Guttormsen 2026-07-15 11:18:40 +02:00
commit 82c85d5e7c
4 changed files with 27 additions and 2 deletions

View file

@ -64,6 +64,19 @@ def test_azure_backend_fails_fast_without_endpoint(monkeypatch: pytest.MonkeyPat
get_backend("azure").create_chat_client(model="dummy-deployment")
def test_azure_backend_constructs_with_credential(monkeypatch: pytest.MonkeyPatch) -> None:
# S4.1: FoundryChatClient REQUIRES an explicit credential (verified: pinned agent-framework-
# foundry 1.8.2 raises ValueError without it). The backend now supplies a lazy
# AzureCliCredential — construction succeeds OFFLINE (no token acquired until first use).
# Detach point: drop credential= in create_chat_client → construction raises → RED.
monkeypatch.setenv(
"PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT",
"https://x.services.ai.azure.com/api/projects/p",
)
client = get_backend("azure").create_chat_client(model="gpt-4o-mini")
assert isinstance(client, BaseChatClient)
def test_model_map_resolves_role_to_model(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.delenv("PORTFOLIO_MODEL_MAP", raising=False)
assert resolve_model("local", "proposer") == "qwen3:4b"