Func<DurableRuntimePumpRequest, CancellationToken, ValueTask<DurableRuntimePumpAttempt>>? Admission { get; set; }
Source
Delegate for admission-aware attempts; defaults to a completed empty pass.
Immutable public facts observed from a typed Work definition.
DurableWorkDefinitionObservation Capture<TWork, TResult>(DurableWorkDefinition<TWork, TResult> definition)
Captures definition identity, codec metadata, safety, and retry defaults without asserting.
Immutable observation of an exact registry lookup.
DurableWorkRegistryObservation Capture(IDurableWorkRegistry registry, string workName, string workVersion)
Performs the production exact lookup; missing-registration exceptions propagate unchanged.
Immutable observation of a binding's exact definition reference.
DurableWorkBindingObservation Capture<TWork, TResult, TExecutor>(DurableWorkBinding<TWork, TResult, TExecutor> binding)
Captures binding identity without resolving services or invoking work.
Builds production-validated runtime health snapshots for tests.
Named states supply representative valid defaults. Overrides are applied before production validation.
DurableHealthSnapshotBuilder ForState(DurableRuntimeHealthState state)
Selects representative defaults for a defined health state.
DurableHealthSnapshotBuilder WithProblemCode(string? value)
Overrides the optional privacy-safe problem code.
DurableHealthSnapshotBuilder WithSchemaCompatible(bool value)
Overrides schema compatibility.
DurableHealthSnapshotBuilder WithEpochCompatible(bool value)
Overrides epoch compatibility.
DurableHealthSnapshotBuilder WithInstalledSchemaVersion(int value)
Overrides installed schema version.
DurableHealthSnapshotBuilder WithRequiredSchemaVersion(int value)
Overrides required schema version.
DurableHealthSnapshotBuilder WithConfiguredRuntimeEpoch(Guid value)
Overrides configured runtime epoch.
DurableHealthSnapshotBuilder WithActiveRuntimeEpoch(Guid? value)
Overrides active runtime epoch.
DurableHealthSnapshotBuilder WithWorkerId(string value)
Overrides worker identity.
DurableHealthSnapshotBuilder WithWorkerInstanceId(Guid? value)
Overrides worker instance identity.
DurableHealthSnapshotBuilder WithHostedSurfaces(DurableRuntimeSurface value)
Overrides hosted surfaces.
DurableHealthSnapshotBuilder WithObservedAtUtc(DateTimeOffset value)
Overrides observation time.
DurableHealthSnapshotBuilder WithStartedAtUtc(DateTimeOffset? value)
Overrides runtime start time.
DurableHealthSnapshotBuilder WithLastHeartbeatAtUtc(DateTimeOffset? value)
Overrides heartbeat time.
DurableHealthSnapshotBuilder WithLastSuccessfulSweepAtUtc(DateTimeOffset? value)
Overrides last successful sweep time.
DurableHealthSnapshotBuilder WithIsDraining(bool value)
Overrides drain state.
DurableHealthSnapshotBuilder WithIsPassActive(bool value)
Overrides active-pass state.
DurableHealthSnapshotBuilder WithDueDispatchCount(long value)
Overrides overdue dispatch count.
DurableHealthSnapshotBuilder WithOldestDueAtUtc(DateTimeOffset? value)
Overrides oldest due instant.
DurableHealthSnapshotBuilder WithOldestDueAge(TimeSpan? value)
Overrides oldest due age.
DurableRuntimeHealthSnapshot Build()
Builds the selected representative snapshot and delegates all validation to production.
DurableRuntimeHealthSnapshot BuildContradictoryForTest()
Builds a deliberately contradictory snapshot for tests of consumers handling inconsistent fields.
Records calls to both durable pump contracts and optionally delegates execution.
History is retained for this instance until ClearHistory
. Snapshots freeze order and scalar metadata, while requests remain shallow references; callers should not mutate their payload-bearing inputs during assertions. Payload values are never formatted or serialized. Calls canceled before delegate invocation are recorded as canceled. Once a delegate starts, its actual result or exception is recorded even if it ignores a subsequently canceled token.
void ClearHistory()
Atomically removes current history; already-running calls from earlier generations stay removed.
Func<DurableRuntimePumpRequest, CancellationToken, ValueTask<DurableRuntimePumpAttempt>>? Admission { get; set; }
Source
Delegate for admission-aware attempts; defaults to a completed empty pass.
Func<DurableRuntimePumpRequest, CancellationToken, ValueTask<DurableRuntimePumpResult>>? Pump { get; set; }
Source
Delegate for legacy pump calls; defaults to a completed empty pass.
ImmutableArray<DurableRuntimePumpCall> History { get; }
Source
Gets an atomic immutable snapshot ordered by invocation start.
An immutable invocation record; request is the exact shallow caller reference.
string ToString()
Formats only safe scalar call metadata, never retained request or delegate objects.
Builds validated bounded pump requests with production defaults.
DurableRuntimePumpRequestBuilder WithMaximumItems(int value)
Sets the total item bound.
DurableRuntimePumpRequestBuilder WithTimeBudget(TimeSpan value)
Sets the pass time budget.
DurableRuntimePumpRequestBuilder WithSurfaces(DurableRuntimeSurface value)
Sets selected durable surfaces.
DurableRuntimePumpRequest Build()
Creates the production request, preserving its validation exceptions.
Builds validated bounded pump results with zero-count defaults.
DurableRuntimePumpResultBuilder WithCounts(int discovered, int claimed, int processed, int deferred, int failed)
Sets all pass counters.
DurableRuntimePumpResultBuilder WithHasMore(bool value)
Sets whether more immediately eligible work may remain.
DurableRuntimePumpResultBuilder WithNextDueAtUtc(DateTimeOffset? value)
Sets the earliest known future due time.
DurableRuntimePumpResultBuilder WithElapsed(TimeSpan value)
Sets elapsed pass duration.
DurableRuntimePumpResult Build()
Creates the production result, preserving its validation exceptions.
Builds a validated pump attempt, defaulting to a completed empty pass.
DurableRuntimePumpAttemptBuilder WithKind(DurableRuntimePumpAttemptKind value)
Selects the attempt kind; an explicit result override is preserved regardless of call order.
DurableRuntimePumpAttemptBuilder WithResult(DurableRuntimePumpResult? value)
Overrides the completed pass result, including with null; production validation rejects contradictions.
DurableRuntimePumpAttemptBuilder WithProblemCode(string? value)
Sets the provider problem code.
DurableRuntimePumpAttempt Build()
Creates the production attempt, preserving its validation exceptions.
Immutable, payload-free facts recorded when a test execution reaches a checkpoint.
A safe deterministic exception emitted by a one-shot test checkpoint.
DurableExecutionCheckpointName Name { get; }
Source
Gets the checkpoint that threw.
int AttemptNumber { get; }
Source
Gets the attempt number supplied by the provider test seam.
An immutable Testing-package view of accepted execution-policy facts.
DurableWorkExecutionObservation Capture(DurableWorkExecutionSnapshot snapshot)
Copies the immutable descriptive facts from a Core execution snapshot.
Records bounded immutable checkpoint observations and optionally pauses or throws once at one stage.
A checkpoint does not grant execution authority or simulate a provider result. The caller must explicitly release or cancel a configured pause. Both a pause and an observation wait have the configured maximum wait and also honor their caller's cancellation token. Disposal releases every active pause by canceling it.
void PauseOnce(DurableExecutionCheckpointName name)
Configures one invocation at name
to pause once.
InvalidOperationException
void ThrowOnce(DurableExecutionCheckpointName name)
Configures one invocation at name
to throw a safe test exception once.
ValueTask ReachAsync(DurableExecutionCheckpointName name, int attemptNumber, CancellationToken cancellationToken = default)
Records a checkpoint, then applies its armed one-shot pause or exception, if any.
DurableExecutionCheckpointException
TimeoutException
ValueTask<DurableExecutionCheckpointObservation> WaitForObservationAsync(DurableExecutionCheckpointName name, CancellationToken cancellationToken = default)
Waits for the first retained matching observation, with the configured maximum wait and caller cancellation.
The latest observation for a stage remains waitable after bounded history evicts it.
ValueTask<DurableExecutionCheckpointObservation> WaitForObservationAsync(DurableExecutionCheckpointName name, long afterSequence, TimeSpan maximumWait, CancellationToken cancellationToken = default)
Waits for a matching observation recorded after afterSequence
.
name
afterSequence
maximumWait
cancellationToken
ArgumentOutOfRangeException
TimeoutException
maximumWait
.The earliest qualifying observation still in bounded history is returned. If qualifying history was evicted, the latest observation for the stage is returned when it is newer than the cursor. If that latest observation is not newer than the cursor, the wait continues until a qualifying observation arrives or the wait expires.
bool Release(DurableExecutionCheckpointName name)
Releases a currently paused one-shot checkpoint; returns false when none is paused.
bool Cancel(DurableExecutionCheckpointName name)
Cancels an armed or active one-shot pause; returns false when nothing can be canceled.
void Dispose()
Cancels all active pauses and prevents new checkpoints or arms.
IReadOnlyList<DurableExecutionCheckpointObservation> Observations { get; }
Source
Returns a defensive, read-only copy of the observations retained so far.
A successfully published health assessment used by later pump calls.
Sequence
Snapshot
Identifies one provider admission call, including an eventual outcome after a scenario wait times out.
The request and assessment are exact references. Completion
is a repeat-awaitable task: a returned attempt describes this invocation only, and a fault after execution starts can still require provider recovery. The scenario retains handles until DurableHostScenario.ClearCompletedPumpInvocations
removes them.
long Sequence { get; }
Source
Gets the invocation-start order within its scenario.
DurableRuntimePumpRequest Request { get; }
Source
Gets the exact bounded request passed to provider admission.
DurableScenarioHealthAssessment Assessment { get; }
Source
Gets the assessment captured before this call; it is advisory, not an admission gate.
Task<DurableRuntimePumpAttempt> Completion { get; }
Source
Gets the eventual provider attempt or its cancellation or exception.
Reports that a scenario stopped waiting without inventing a provider outcome.
A pump timeout after admission starts includes Invocation
. Await its DurableScenarioPumpInvocation.Completion
before releasing provider resources. A health timeout or a timeout before admission has no invocation handle. A timeout does not cancel the provider call.
DurableScenarioPhase Phase { get; }
Source
Gets the phase whose wait expired.
DurableScenarioTimeoutReason Reason { get; }
Source
Gets the expired budget.
DurableScenarioPumpInvocation? Invocation { get; }
Source
Gets the started provider pump invocation, if any.
bool InvocationStarted { get; }
Source
Gets whether provider pump admission was invoked.
bool ExecutionStatusUnknown { get; }
Source
Gets whether provider execution status remains unknown until the invocation is observed.
Composes a health observation and one or more authoritative pump admissions for deterministic host tests.
The latest successfully published health snapshot is advisory. It never gates admission. One overall monotonic budget begins with the first health assessment and never resets; construct a new scenario for a new budget. The supplied TimeProvider
must provide monotonic timestamps through TimeProvider.GetTimestamp
. The scenario wait deadline never cancels provider work: only the caller's cancellation token reaches provider methods. A scenario retains pump handles and their shallow request references until ClearCompletedPumpInvocations
is called or the scenario is released. Await timed-out handles before releasing provider or test resources. This helper does not implement provider persistence or retry policy.
Task<DurableScenarioHealthAssessment> AssessHealthAsync(CancellationToken cancellationToken = default)
Reads and publishes one health snapshot if its provider result wins the method's terminal decision.
DurableScenarioTimeoutException
OperationCanceledException
Failed, canceled, or timed-out reads do not replace the latest assessment. A late provider result after timeout is observed for faults but is never published. Concurrent successful reads publish in method terminal-decision order under the scenario lock, even when the later publication was started first. A provider task finishing does not by itself publish an assessment. A health timeout has no pump invocation handle.
Task<DurableRuntimePumpAttempt> RunDirectPumpOnceAsync(CancellationToken cancellationToken = default)
Invokes authoritative provider admission once after a completed assessment and returns its exact attempt.
InvalidOperationException
DurableScenarioTimeoutException
OperationCanceledException
DurableRuntimeHealthSnapshot.CanAttemptPump
is advisory and never gates this method. A timeout or caller cancellation after invocation starts leaves a retained handle in PumpInvocations
. Await its completion before releasing provider resources; do not infer a refusal or retry safety from a local timeout.
int ClearCompletedPumpInvocations()
Atomically removes terminal pump handles while keeping in-flight handles reachable.
The number of completed handles removed.
The caller retains any handle already obtained from a timeout or prior snapshot. Call this after awaiting timed-out handles when reusing a scenario, so exact request references do not remain in its history.
IReadOnlyList<DurableScenarioPumpInvocation> PumpInvocations { get; }
Source
Gets an atomic, start-ordered snapshot of retained provider pump invocations.
DurableScenarioHealthAssessment? LatestAssessment { get; }
Source
Gets the most recently published successful health assessment, if any.
A configurable in-memory health reader for deterministic tests.
The configured snapshot is returned unchanged. No payloads are logged or serialized.
ValueTask<DurableRuntimeHealthSnapshot> GetAsync(CancellationToken cancellationToken = default)
Reads the configured snapshot, honoring cancellation before returning.
DurableRuntimeHealthSnapshot Snapshot { get; set; }
Source
Gets or sets the snapshot returned to subsequent callers.
In-memory drain control that records each state transition request.
bool IsDraining { get; }
Source
Gets the current drain state.
ImmutableArray<DurableRuntimeDrainTransition> History { get; }
Source
Gets an atomic immutable transition snapshot.
A recorded drain-state request in invocation order.
Builds a typed Work request by delegating encoding and identity to its definition.
TWork
TResult
DurableWorkRequestBuilder<TWork, TResult> WithScope(DurableScopeId value)
Sets owning scope; the default is test-scope
.
DurableWorkRequestBuilder<TWork, TResult> WithCommand(DurableCommandId value)
Sets command identity; the default is test-command
.
DurableWorkRequestBuilder<TWork, TResult> WithIdempotencyKey(string value)
Sets idempotency key.
DurableWorkRequestBuilder<TWork, TResult> WithWork(TWork value)
Sets typed work input.
DurableWorkRequestBuilder<TWork, TResult> WithRetryPolicy(DurableWorkRetryPolicy? value)
Sets a retry override.
DurableWorkRequestBuilder<TWork, TResult> WithDueAtUtc(DateTimeOffset? value)
Sets initial eligibility time.
DurableWorkRequest Build()
Creates the request through DurableWorkDefinition{TWork,TResult}.CreateRequest
.
Builds native worker envelopes while retaining execution and fence identity.
TPayload
DurableWorkerEnvelopeBuilder<TPayload> WithOutcome(DurableWorkerProjectionOutcome value)
Sets outcome.
DurableWorkerEnvelopeBuilder<TPayload> WithReasonCode(string value)
Sets safe reason code.
DurableWorkerEnvelopeBuilder<TPayload> WithRetryability(DurableWorkerRetryability value)
Sets retry classification.
DurableWorkerEnvelopeBuilder<TPayload> WithCorrelation(DurableWorkerCorrelation value)
Sets correlation identity.
DurableWorkerEnvelopeBuilder<TPayload> WithExecutionIdentity(DurableWorkerExecutionIdentity value)
Sets required native execution and fencing identity.
DurableWorkerEnvelopeBuilder<TPayload> WithPayload(TPayload? value)
Sets optional typed payload.
DurableWorkerEnvelope<TPayload> Build()
Creates the envelope through DurableWorkerEnvelope{TPayload}.CreateNative
.
Identifies which production pump contract was invoked.
Identifies a deterministic Work execution boundary available to tests.
Identifies the phase in which a durable host scenario stopped waiting.
Identifies which scenario wait budget expired.