Pattern Proposal: Client Adapter and Test Double
Summary
Separates real external network/API communication from test environments via symmetric client interfaces.
Candidate Pattern
- ID:
client-adapter-test-double - Classification: architectural
- Maturity: established
- Type: implemented
Observed Signals
No specific signals listed.
Evidence
Supporting Evidence
- src/cas_runner/llm/litellm_client.py (LiteLLMClient) - Production adapter calling external LiteLLM APIs.
- src/cas_runner/llm/mock_client.py (MockLLMClient) - Offline test double providing stubbed or simulated responses.
Scope Assessment
- Evidence Strength: high
- Confidence: high
- Applies to: ideas-to-life-cas
Rationale
- Intent: Allow offline execution, deterministic testing, and CI validation without calling live external provider APIs.
- Context: External integrations (such as LiteLLM API providers) are costly, non-deterministic, or unavailable during local builds and unit tests.
- Force: Components requiring provider interaction must execute without active internet connections or credentials
- Force: Mock implementations must adhere to the identical call interface as real clients
Traceability
Artifact source: proposed-patterns