# `Spectre.Governance.EvaluationDelta`
[🔗](https://github.com/elchemista/spectre/blob/0.3.0/lib/spectre/governance/evaluation_delta.ex#L1)

Deterministic comparison of parent and Candidate results on the same corpus.

Parent/Candidate score deltas are computed only from protected cases. Cases
introduced by the current Candidate are tracked separately and must pass,
but can never improve its score or compensate for a protected regression.
Protected identity covers each complete canonical `Spectre.Eval.Case`, not
only its id, so changing an input, oracle, policy, state, or tag changes the
corpus digest.

# `result`

```elixir
@type result() :: %{required(String.t()) =&gt; String.t() | boolean() | number()}
```

# `t`

```elixir
@type t() :: %Spectre.Governance.EvaluationDelta{
  candidate_case_failures: [String.t()],
  candidate_cases_digest: String.t(),
  candidate_owned_results: [map()],
  candidate_score: float(),
  max_regressions: non_neg_integer(),
  min_score_delta: float(),
  parent_score: float(),
  passed: boolean(),
  protected_cases: [map()],
  protected_cases_digest: String.t(),
  protected_results: [map()],
  regressions: [String.t()],
  schema_version: pos_integer(),
  score_delta: float()
}
```

# `digest`

```elixir
@spec digest(t()) :: String.t()
```

Returns the canonical evaluation-delta digest.

# `from_data`

```elixir
@spec from_data(map()) :: {:ok, t()} | {:error, term()}
```

Restores and recomputes an evaluation delta from portable data.

# `new`

```elixir
@spec new([map()], [map()], keyword()) :: {:ok, t()} | {:error, term()}
```

Builds an evaluation delta from parent and Candidate result lists.

# `new!`

```elixir
@spec new!([map()], [map()], keyword()) :: t()
```

Builds an evaluation delta or raises with the stable reason.

# `protected_corpus_digest`

```elixir
@spec protected_corpus_digest([Spectre.Eval.Case.t() | map()]) ::
  {:ok, String.t()} | {:error, term()}
```

Computes the canonical digest of complete protected case content.

# `protected_corpus_digest!`

```elixir
@spec protected_corpus_digest!([Spectre.Eval.Case.t() | map()]) :: String.t()
```

Computes the protected-corpus digest or raises with the stable reason.

# `to_data`

```elixir
@spec to_data(t()) :: map()
```

Returns JSON-shaped evaluation evidence.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
