Skip to content

IExperimentItemScope TCase,TOutput

NexusLabs.Foundry.Evaluation

NexusLabs.Foundry.Evaluation.Experiments

IExperimentItemScope<TCase,TOutput> Interface

Provides one provider lifecycle spanning every attempt and item evaluation for a trial.

public interface IExperimentItemScope<TCase,TOutput> : System.IAsyncDisposable

Type parameters

TCase

The caller-owned case value type.

TOutput

The caller-owned output type.

Implements System.IAsyncDisposable

Properties

IExperimentItemScope<TCase,TOutput>.Features Property

Gets exact-type adapter features exposed to the task and item evaluator.

System.Collections.Generic.IReadOnlyDictionary<System.Type,object> Features { get; }

Property Value

System.Collections.Generic.IReadOnlyDictionary<System.Type,System.Object>

Methods

IExperimentItemScope<TCase,TOutput>.AbortAsync(CancellationToken) Method

Aborts an incomplete trial after caller cancellation.

System.Threading.Tasks.ValueTask AbortAsync(System.Threading.CancellationToken cancellationToken);

Parameters

cancellationToken System.Threading.CancellationToken

The bounded cleanup cancellation token.

Returns

System.Threading.Tasks.ValueTask
A task that completes when abort handling finishes.

Remarks

This method runs without ambient activation and must not publish a completed item record.

IExperimentItemScope<TCase,TOutput>.Activate() Method

Activates provider context around one task attempt or item-evaluator invocation.

System.IDisposable? Activate();

Returns

System.IDisposable
The context-restoration handle, or null.

Remarks

The runner invokes this for every activation and disposes the returned handle in reverse scope order. A null handle indicates that no ambient context needs restoration.

IExperimentItemScope<TCase,TOutput>.CompleteAsync(ExperimentItemResult<TCase,TOutput>, CancellationToken) Method

Receives the terminal quality result and completes provider publication work.

System.Threading.Tasks.ValueTask<NexusLabs.Foundry.Evaluation.Experiments.ExperimentItemPublicationOperationResult> CompleteAsync(NexusLabs.Foundry.Evaluation.Experiments.ExperimentItemResult<TCase,TOutput> result, System.Threading.CancellationToken cancellationToken);

Parameters

result NexusLabs.Foundry.Evaluation.Experiments.ExperimentItemResult<TCase,TOutput>

The terminal execution and evaluation result.

cancellationToken System.Threading.CancellationToken

The caller cancellation token.

Returns

System.Threading.Tasks.ValueTask<ExperimentItemPublicationOperationResult>
The structured publication operation result.

Remarks

This method runs without ambient activation. Implementations must use scope-owned state and must not mutate the supplied result. The runner calls either this method or AbortAsync(CancellationToken), then always calls System.IAsyncDisposable.DisposeAsync. Once completion starts, caller cancellation is delivered only through cancellationToken; implementations must not publish a completed item after observing cancellation.