Failure classes
TypeSafe HTTP failures are normalized into Decision-specific exceptions:
All five extend
DecisionProviderException, which exposes statusCode, retryAfter, and isRetriable().
InvalidArgumentException. Examples include empty question IDs, duplicate IDs, an executable request with no questions, a Choice with no options, a Score with fewer than two levels, unsupported JSON values, and incomplete configuration.
Provider exception messages deliberately exclude request bodies, response bodies, API keys, state, and question content. Preserve that boundary in application logs.
Deterministic test seams
Choose the shallowest seam that covers the behavior under test:- Implement
CanProcessDecisionRequestas an in-memory fake for application logic, facade behavior, pending execution, retries, and lifecycle events. - Inject an HTTP client backed by
MockHttpDriverto exercise the TypeSafe request and response adapters, headers, payload shape, error classification, and provider request IDs. - Use the live smoke only to verify real credentials and provider compatibility.
DecisionRuntime::fromConfig(..., httpClient: $httpClient). No ordinary unit or feature test should require TYPESAFE_API_KEY.
Opt-in live smoke
The repository includes one bounded live integration test:TYPESAFE_API_KEY, and emits only safe endpoint, model, count, and usage evidence.