Executable contract checks for third-party Router Adapters.
Adapter packages provide a deterministic %Spectre.Router.Adapter.Request{}
fixture whose rules are expected to produce evidence. The runner validates
the descriptor, isolates evaluate/1 behind the normal provider boundary,
and applies the same strict result normalizer and thresholds used by live
routing.
Summary
Functions
Returns the Router Adapter conformance contract version.
Runs the Adapter contract against one deterministic Request fixture.
Types
@type phase() :: :options | :descriptor | :fixture | :callback | :result
@type report() :: %{ contract_version: pos_integer(), adapter_id: atom(), result_count: non_neg_integer(), accepted_count: non_neg_integer(), rejected_count: non_neg_integer(), thresholds: %{score: float(), margin: float() | nil} }
Functions
@spec contract_version() :: pos_integer()
Returns the Router Adapter conformance contract version.
@spec run(module(), Spectre.Router.Adapter.Request.t(), keyword()) :: {:ok, report()} | {:error, failure()}
Runs the Adapter contract against one deterministic Request fixture.
The fixture must contain at least one valid RuleView and the callback must
return {:ok, result_or_results}. A skip or declared error is valid during
normal routing but cannot prove result conformance, so this runner reports it
in the :callback phase.