Repository navigation
Testing
Home · Installation · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Testing · Troubleshooting · Project Tracker
swift test| Property | Value |
|---|---|
| Tests | 287 (plus opt-in live tests, skipped without a real key) |
| Runtime | ~13 seconds |
| External network | not required |
| Warnings | none, from a clean build |
End-to-end tests launch the real executable with a scrubbed environment: PATH plus
their own explicit overrides, with every documented provider variable removed.
Without that scrub, an exported TAVILY_API_KEY — exactly what the installation guide
tells a user to set — would make the stub-provider test contact the live vendor and fail.
This was a real defect, so it is now verified rather than assumed. The same list covers
DEEPSEEK_API_KEY and the other synthesis variables: the test asserting that
web_answer degrades to results_only when unconfigured would otherwise make a live,
billed request on any machine where the developer had exported a key. The suite is run
with fake credentials present to prove it:
TAVILY_API_KEY=tvly-fake BRAVE_SEARCH_API_KEY=brave-fake swift testCI runs the whole suite a second time with credentials present for the same reason.
| File | Covers |
|---|---|
CoreUnitTests |
URL canonicalization, configuration parsing, durations, logging |
FusionAndReliabilityTests |
RRF fusion, deduplication, diversity capping, aggregator weighting, circuit breaker, rate limiter, cache |
URLPolicyTests |
SSRF: schemes, loopback/private/metadata literals, DNS resolution, IP classification |
HTMLExtractorTests |
Readable-text extraction, boilerplate removal, scraper parsing, challenge detection |
HTTPClientTests |
Retry, Retry-After, idempotency, size limits, cancellation, Latin-1 fallback |
ProviderContractTests |
Per-adapter contract and failure taxonomy |
AnswerSynthesizerTests |
Grounding rules, citation validation and renumbering, refusal handling, thinking-mode request shape, credential placement |
SearchOrchestratorTests |
Selection, fan-out, failover, timeouts, caching, domain filtering |
StdioServerTests |
Real MCP handshake, tool schemas, tool calls, stdout purity, the web_answer end-to-end path |
SchemaCompatibilityTests |
Every advertised schema against the strictest client rules |
TransportConfigurationTests |
CLI flag parsing, defaults and rejection of bad arguments |
ErrorReportingTests |
Error attribution, explicit-provider fallback, post-error liveness |
MonitorTests |
Probe parsing, interval floor, renderer output |
LiveProviderTests |
Opt-in. Real API calls; skipped unless a key is present |
LoopbackServer binds 127.0.0.1 and speaks HTTP/1.1, so retry, Retry-After,
idempotency, size limits and cancellation are verified against real socket behaviour
rather than against a mock that would encode the same assumptions as the client.
Every covered adapter must satisfy the same contract:
| Expectation | Assertion |
|---|---|
| Happy path | Normalized results with valid URLs and ranks |
401 / 403
|
Classified as authentication
|
429 |
Classified as rate_limited, with Retry-After parsed |
5xx |
Classified as transient |
| Malformed body | Clean malformed_response failure, never junk results |
| Cancellation | Stops in-flight work |
| Credentials | Never appear in logs or diagnostics |
Covered: Tavily, Brave, Mojeek, Exa, SearXNG, DuckDuckGo. Gaps are recorded on the Project Tracker.
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. Fusion ordering is fully deterministic, so ranking
assertions are stable.
python3 scripts/mcp_smoke.pyA dependency-free client that drives the built binary through a real handshake and asserts that:
-
initializesucceeds and reports the expected server identity; -
tools/listexposes exactly four tools with valid object schemas, andweb_answerexposes no model-selection argument; -
web_searchwith no provider configured fails as an actionable tool error; - every line written to stdout is valid JSON-RPC;
- diagnostics appear on stderr, never stdout.
It keeps stdin open until all replies have been read, which is what the stdio transport contract requires.
.github/workflows/ci.yml runs on macos-26 (Xcode 26.x, Swift 6.3) for every push and
pull request to main:
swift build --build-testsswift testswift build -c release-
python3 scripts/mcp_smoke.py— stdio handshake and stdout purity -
python3 scripts/mcp_smoke.py --http— starts the HTTP transport, waits for/health, drives a full stateful session over SSE, and checks that requests without a session, without SSE inAccept, and from a cross-origin page are refused -
swift testagain with provider credentials present, proving hermeticity
The toolchain version is asserted before anything else, because a
swift-tools-version: 6.3 manifest cannot even be parsed by an older Swift.
Automation is not ceremony here: it found three defects that local builds had hidden.
-
macos-14ships Swift 5.10, which cannot parse the manifest. -
Package.swiftdeclared a resource bundle for a directory git does not track, so a clean checkout failed to build while local builds passed. - A trailing-
deferwarning that only a from-scratch build surfaced.
swift test --filter LiveProviderTestsThese call real APIs, so they are opt-in and skipped by default. They run only when
TAVILY_API_KEY is present, either in the environment or in a git-ignored config.env
at the package root.
They are written to be frugal with a metered free tier: fast mode, small result
counts, and most assertions made against a single live response. The authentication
path is covered with a deliberately invalid key, which costs no credits. Coverage:
| Test | What it proves | Cost |
|---|---|---|
| Invalid key | A rejected credential is classified as authentication, not transient | free |
| Search | Live results normalize correctly, with scores and sequential ranks | 1 credit |
| Recency | A recency filter returns dated results, so the filter is verifiable | 1 credit |
| Orchestration | Full path with fusion and a cache hit on the repeat query | 1 credit |
| Thorough mode | The advanced-depth mapping reaches the live service | 2 credits |
| Status | A live key reports ready and the payload never contains the key |
free |
This suite exists because it found a defect the stub tests could not: Tavily's
published_date silently decoded to nil, since the DTO maps keys explicitly while the
adapter had been applying .convertFromSnakeCase, which rewrites the key before those
mappings are consulted.
SchemaCompatibilityTests walks every advertised input and output schema, via a real
tools/list over stdio, and fails on any construct a mainstream client rejects: a
missing additionalProperties: false, a property that is not also required, a banned
keyword (format, default, oneOf, allOf, not), an object without properties,
an array without items, a non-object root, or an over-long tool or property name. It
also asserts that defaults are documented in descriptions rather than declared, and that
every required-but-optional property is nullable so a strict client can omit it.
See Compatibility for why each rule exists.
python3 scripts/soak.py --queries 50 --mode balancedRuns a list of realistic coding-agent queries through the real binary and reports per-query outcome, provider participation, failure categories and end-of-run provider health. It exists because quota and rate-limit behaviour only appears over a sustained run: a single-query test cannot show that an anonymous tier allows exactly 20 calls, or that a scraper's throttle turns into one error per query once it is exhausted.
It is opt-in, spends real credits, and is not part of CI. The measured limits are recorded on the Project Tracker.
Live provider behaviour is non-deterministic and free tiers are metered. A scheduled live smoke test on CI is still open work on the Project Tracker.
Home · Installation · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Self-Hosting · Monitor · Testing · Troubleshooting · Project Tracker