# EvalRunDiffBuilder

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.evalrundiffbuilder/
> Summary: EvalRunDiffBuilder: Aligns two eval runs' per-case results into an EvalRunDiff.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

Aligns two eval runs' per-case results into an [EvalRunDiff](/api/tracon.evalrundiff/).

```csharp
public static class EvalRunDiffBuilder
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.evalrundiffbuilder/">EvalRunDiffBuilder</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

This is the whole comparison policy — the bucket rules, the repetition rule,
the ordering and the three refusals — in one place, so that every
[IEvalStore](/api/tracon.ievalstore/) implementation shares it instead of rewriting it.
A store's [IEvalStore.DiffRunsAsync](/api/tracon.ievalstore/#Tracon_IEvalStore_DiffRunsAsync_Tracon_EvalRunDiffQuery_System_Threading_CancellationToken_) reads the two runs and
their case results and hands them here.

## Methods

### <a id="Tracon_EvalRunDiffBuilder_Build_Tracon_EvalRun_Tracon_EvalRun_System_Collections_Generic_IReadOnlyList_Tracon_EvalCaseResult__System_Collections_Generic_IReadOnlyList_Tracon_EvalCaseResult__System_Int32_System_Int32_"></a> Build\(EvalRun, EvalRun, IReadOnlyList<EvalCaseResult\>, IReadOnlyList<EvalCaseResult\>, int, int\)

Aligns two completed runs of the same suite, case by case.

```csharp
public static EvalRunDiff Build(EvalRun baseline, EvalRun candidate, IReadOnlyList<EvalCaseResult> baselineResults, IReadOnlyList<EvalCaseResult> candidateResults, int skip = 0, int take = 2147483647)
```

#### Parameters

`baseline` [EvalRun](/api/tracon.evalrun/)

The run being compared against.

`candidate` [EvalRun](/api/tracon.evalrun/)

The run being judged.

`baselineResults` [IReadOnlyList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist\-1)<[EvalCaseResult](/api/tracon.evalcaseresult/)\>

The baseline run's per-case results.

`candidateResults` [IReadOnlyList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist\-1)<[EvalCaseResult](/api/tracon.evalcaseresult/)\>

The candidate run's per-case results.

`skip` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The number of aligned cases to skip.

`take` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The maximum number of aligned cases to return.

#### Returns

 [EvalRunDiff](/api/tracon.evalrundiff/)

The difference between the two runs.

#### Remarks

A case that carries several result rows within one run — the suite ran
with repetitions, or the job was redelivered and recorded its results a
second time ([IJobHandler](/api/tracon.ijobhandler/) is at-least-once) — counts as
passed only when **every** one of its rows passed. That is
the same rule [EvalRun.Passed](/api/tracon.evalrun/#Tracon_EvalRun_Passed) itself uses for repetitions,
and it fails safe for the redelivery case: a stale failing row can show
a case as broken when it is not, but it can never hide a break.

#### Exceptions

 [EvalRunDiffUnavailableException](/api/tracon.evalrundiffunavailableexception/)

The two runs measure different suites, one of them has not completed, or
one of them holds results for fewer cases than its summary counts - the
rest were removed by retention, which deletes in batches and can leave a
run partly trimmed. Never answered with a shortened diff: reporting only
the surviving cases reads as "nothing changed" for the rest.
