# RunScoreBucketing

> 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.runscorebucketing/
> Summary: RunScoreBucketing: Shared pure logic for score trend bucket truncation (RunScoreBucket).

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

Shared pure logic for score trend bucket truncation ([RunScoreBucket](/api/tracon.runscorebucket/)).

```csharp
public static class RunScoreBucketing
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.runscorebucketing/">RunScoreBucketing</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

Used by `InMemoryRunScoreStore` directly; each SQL provider mirrors the
same rule in its own date-truncation SQL, so the bucket boundary never
diverges between implementations — a shared contract test checks this
across all four.

## Methods

### <a id="Tracon_RunScoreBucketing_Truncate_System_DateTimeOffset_Tracon_RunScoreBucket_"></a> Truncate\(DateTimeOffset, RunScoreBucket\)

Rounds a timestamp down to its bucket boundary, in UTC.

```csharp
public static DateTimeOffset Truncate(DateTimeOffset value, RunScoreBucket bucket)
```

#### Parameters

`value` [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

The timestamp to round down.

`bucket` [RunScoreBucket](/api/tracon.runscorebucket/)

The bucket width.

#### Returns

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

The bucket's start (UTC). A [RunScoreBucket.Week](/api/tracon.runscorebucket/) bucket starts on Monday (ISO 8601).
