Skip to content
Tracon

StatePreflight

Namespace Tracon · Assembly Tracon.Core.dll

Answers “can this build still read the state already in the database” WITHOUT writing anything and without starting the application.

public sealed class StatePreflight

objectStatePreflight

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

The question is normally answered in production, after the upgrade. This class moves it BEFORE the upgrade: it counts the stored schema generations across every tenant, compares them against what the running code writes, and tries to decode a small sample.

Nothing here writes. It reads through IStatePreflightReader, which issues only SELECT statements, and it never touches ISessionStore — restoring a session through the normal path would stamp and save.

The decode probe builds a bare AI.ChatClientAgent over a chat client that refuses every call. Microsoft Agent Framework’s DeserializeSessionAsync never invokes the chat client, so a preflight needs no model provider, no API key and no agent definition — which is what lets it run from the CLI, against a database whose application is not even up.

Creates a new preflight over a read-only reader.

public StatePreflight(IStatePreflightReader reader)

reader IStatePreflightReader

The read-only source of stored state.

ArgumentNullException

reader is null.

Runs the preflight.

public ValueTask<StatePreflightReport> RunAsync(int samplePerGeneration = 5, CancellationToken cancellationToken = default)

samplePerGeneration int

How many rows of EACH stored generation to decode. 0 counts generations and decodes nothing.

cancellationToken CancellationToken

The cancellation token.

ValueTask<StatePreflightReport>

The report.

ArgumentOutOfRangeException

samplePerGeneration is negative.