Repository navigation
Testing
swift test179 tests, roughly 6 seconds, and no test contacts the public internet.
End-to-end tests launch the real executable with a scrubbed environment: PATH
plus explicitly set overrides, with every documented provider variable removed. Without
this, an exported TAVILY_API_KEY — exactly what the README tells a user to set —
would make the stub-provider test contact the live vendor. This was a real defect; it is
verified by running the suite under a deliberately dirty environment:
TAVILY_API_KEY=tvly-fake BRAVE_SEARCH_API_KEY=brave-fake swift test| File | Covers |
|---|---|
CoreUnitTests |
URL canonicalization, configuration parsing, durations, logging |
FusionAndReliabilityTests |
RRF fusion, dedup, diversity capping, aggregator weighting, circuit breaker, rate limiter, cache |
URLPolicyTests |
SSRF: schemes, loopback/private/metadata literals, DNS resolution, classification |
HTMLExtractorTests |
Readable-text extraction, boilerplate removal, scraper parsing, challenge detection |
HTTPClientTests |
Retry, Retry-After, idempotency, size limit, cancellation, Latin-1 fallback |
ProviderContractTests |
Per-adapter contract and failure taxonomy |
SearchOrchestratorTests |
Selection, fan-out, failover, timeouts, caching, filtering |
StdioServerTests |
Real MCP handshake, tool schemas, tool calls, stdout purity |
ErrorReportingTests |
Error attribution, explicit-provider fallback, post-error liveness |
LoopbackServer binds 127.0.0.1 and speaks HTTP/1.1, so retry, Retry-After,
idempotency and cancellation are verified against real socket behaviour rather than a
mock that would encode the same assumptions as the client.
Each covered adapter must satisfy the same contract: normalized results, 401/403 →
authentication, 429 → rate limited, 5xx → transient, malformed body → clean
failure, cancellation respected, and no credential leakage. Tavily, Brave, Mojeek, Exa,
SearXNG and DuckDuckGo are covered. See the Project Tracker for the
gaps.
CircuitBreaker, RateLimiter and SearchCache take an injectable Clock, so
cooldown and expiry tests advance a TestClock instead of sleeping. Timeout tests use
short budgets rather than real waits.
Live provider behaviour is non-deterministic and free tiers are metered, so live smoke tests belong in a scheduled job rather than the unit suite. Adding that CI job is open work on the tracker.