DurableWorkerProjectionOutcome Outcome { get; }
Source
Gets the observable worker outcome.
Executes the side-effecting portion of a durable worker chain.
TWorkType of work claimed by the chain.TResultType of terminal result produced by executor activity.Executors are expected to run inside host-owned durable activities, queue handlers, or equivalent runtime work. They should not be invoked by projection repair paths. Projection repair uses durable completion facts through IDurableWorkerProjectionContract{TWork,TResult,TProjection} instead.
ValueTask<TResult> ExecuteAsync(DurableWorkerEnvelope<TWork> work, CancellationToken cancellationToken = default)
Source
Runs the side-effecting worker activity for a claimed work item.
workClaimed work envelope that authorized executor scheduling.cancellationTokenToken that cancels executor work.The terminal result that should be recorded with the projection contract.
Identifies the observable result of durable worker claim, completion, or projection repair work.
The numeric values are part of the public worker contract. Do not reorder, remove, renumber, or reuse values. Additive values must be appended with explicit numbers and documented migration behavior.
Carries a durable worker outcome, correlation identifiers, optional typed payload, and privacy-safe metadata.
TPayloadTyped payload associated with the outcome.Envelopes are the stable boundary between app-owned worker contracts and host/runtime adapters. They describe what happened; they do not execute side effects, persist data, or schedule runtime work by themselves.
DurableWorkerProjectionOutcome Outcome { get; }
Source
Gets the observable worker outcome.
string ReasonCode { get; }
Source
Gets the stable machine-readable reason code.
DurableWorkerRetryability Retryability { get; }
Source
Gets the retry classification for this outcome.
DurableWorkerCorrelation Correlation { get; }
Source
Gets correlation identifiers for the operation.
TPayload? Payload { get; }
Source
Gets the optional typed payload associated with the outcome.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets sanitized metadata for logs, durable facts, and projection repair reports.
DurableWorkerDiagnostic? Diagnostic { get; }
Source
Gets optional sanitized diagnostic details.
Registers the passive AppSurface durable worker contract surface.
The module intentionally does not register queues, storage providers, background services, Durable Task workers, EF Core contexts, Postgres connections, endpoints, or authentication handlers. Host applications own runtime infrastructure and persistence; this package provides the shared worker contracts.
Records durable worker execution facts and repairs visible projections from those facts.
TWorkType of work claimed by the chain.TResultType of terminal execution result.TProjectionType of visible projection repaired from durable facts.Implementations are app-owned and persistence-specific. The contract separates side-effect execution from projection repair: TryClaimAsync decides whether executor activity may run, CompleteAsync records a terminal fact, and reconciliation methods update projections without re-running executor activity.
ValueTask<DurableWorkerEnvelope<TWork>> TryClaimAsync(TWork work, DurableWorkerCorrelation correlation, CancellationToken cancellationToken = default)
Source
Attempts to claim a work item before executor activity is scheduled.
workTyped work payload.correlationCorrelation identifiers for the claim.cancellationTokenToken that cancels claim evaluation.A claim envelope. DurableWorkerProjectionOutcome.Claimed means executor activity may be scheduled; duplicate, stale, conflict, and unrecoverable outcomes must not schedule executor activity.
ValueTask<DurableWorkerEnvelope<TResult>> CompleteAsync(TWork work, TResult result, DurableWorkerCorrelation correlation, CancellationToken cancellationToken = default)
Source
Records a terminal execution fact after executor activity completes.
workTyped work payload.resultTerminal result produced by executor activity.correlationCorrelation identifiers for the completion fact.cancellationTokenToken that cancels completion recording.A completion envelope. Successful completion should lead to projection repair; duplicate completions must not trigger projection repair.
ValueTask<DurableWorkerEnvelope<TProjection>> ReconcileProjectionAsync(TWork work, TResult result, DurableWorkerCorrelation correlation, CancellationToken cancellationToken = default)
Source
Repairs the visible projection for one terminal execution fact.
workTyped work payload associated with the terminal fact.resultTerminal result used to derive the visible projection.correlationCorrelation identifiers for the repair attempt.cancellationTokenToken that cancels projection repair.A projection envelope describing repaired, noop, stale, conflict, or unrecoverable repair behavior.
IAsyncEnumerable<DurableWorkerEnvelope<TProjection>> ReconcilePendingProjectionsAsync(DurableWorkerProjectionRepairRequest request, CancellationToken cancellationToken = default)
Source
Repairs a bounded batch of stale or missing projections from durable terminal facts.
requestBounded projection repair request.cancellationTokenToken that cancels projection repair enumeration.Projection repair envelopes for the bounded repair pass.
Describes whether a durable worker outcome should be retried automatically.
These values are intended for workflow decisions and diagnostics. They do not execute retries directly; host adapters translate the value into the chosen runtime's retry, timer, or operator-alert behavior.
Thrown when durable worker diagnostics or metadata contain values that are unsafe to persist or publish.
AppSurface worker metadata is designed for logs, projections, and repair reports. It must use stable identifiers, reason codes, and sanitized values rather than raw source payloads, credentials, OAuth tokens, provider URLs, model output, prompts, message bodies, attachments, or unclassified sensitive text.
Validates the privacy-safe metadata and diagnostic text contract used by durable worker envelopes and diagnostics.
The validator intentionally uses conservative name and value checks for the metadata channel. Store raw business payloads in app-owned data stores, not in worker metadata. Metadata should contain opaque ids, reason codes, bounded counts, and classified safe labels that can appear in logs or repair dashboards.
IReadOnlyDictionary<string, string> CopySafe(IReadOnlyDictionary<string, string>? metadata, string paramName = "metadata")
Source
Validates a metadata dictionary and returns a copied read-only dictionary.
metadataMetadata to validate. A null value is treated as an empty dictionary.paramNameCaller parameter name used in thrown validation exceptions.A read-only copy of the supplied safe metadata.
ArgumentExceptionThrown when a key or value is null, empty, or whitespace.DurableWorkerUnsafeMetadataExceptionThrown when a key or value appears unsafe.void EnsureSafe(IReadOnlyDictionary<string, string>? metadata, string paramName = "metadata")
Source
Validates that metadata is safe for diagnostics, logs, durable facts, and projection repair reports.
metadataMetadata to validate. A null value is treated as an empty dictionary.paramNameCaller parameter name used in thrown validation exceptions.ArgumentExceptionThrown when a key or value is null, empty, or whitespace.DurableWorkerUnsafeMetadataExceptionThrown when a key or value appears unsafe.string CopySafeDiagnosticText(string value, string label, string paramName)
Source
Validates diagnostic text and returns a trimmed safe value.
valueDiagnostic text to validate.labelHuman-readable field label used in validation messages.paramNameCaller parameter name used in thrown validation exceptions.The trimmed diagnostic text.
ArgumentExceptionThrown when value is null, empty, or whitespace.DurableWorkerUnsafeMetadataExceptionThrown when value appears unsafe.Describes a bounded projection repair pass over durable worker completion facts.
Repair requests are intentionally bounded. Hosts should use small batches and repeatable cursors rather than unbounded background scans. The contract repairs projections only; it must not re-run executor side effects.
DateTimeOffset Now { get; }
Source
Gets the clock value used to evaluate stale projections.
TimeSpan MaxStaleness { get; }
Source
Gets the maximum acceptable projection staleness before repair is attempted.
int MaxItems { get; }
Source
Gets the maximum number of pending projection repairs to inspect or return.
Correlates one durable worker operation across claims, executor activity, completion facts, and projection repair.
Correlation values should be stable safe identifiers. Do not use provider URLs, raw payload ids that expose private content, credentials, email bodies, prompts, or model output as correlation values.
string RequireText(string value, string paramName)
Source
Validates and trims a durable worker identifier.
valueIdentifier value to validate.paramNameCaller parameter name used in thrown validation exceptions.The trimmed identifier value.
ArgumentExceptionThrown when value is null, empty, or whitespace.string WorkerName { get; }
Source
Gets the stable worker or chain name.
string WorkId { get; }
Source
Gets the stable app-owned work identifier.
string InstanceId { get; }
Source
Gets the durable runtime instance identifier.
string AttemptId { get; }
Source
Gets the attempt, fence, or generation identifier.
Privacy-safe diagnostic details for a durable worker outcome.
Diagnostics are suitable for logs, repair dashboards, and durable records. Keep them explanatory but sanitized: include stable codes, cause and fix guidance, safe counts, and opaque ids. Do not include raw provider payloads, tokens, credentials, prompts, model output, email bodies, attachments, or unclassified sensitive values.
string Code { get; }
Source
Gets the stable machine-readable diagnostic code.
string Problem { get; }
Source
Gets the safe problem description.
string Cause { get; }
Source
Gets the safe cause description.
string Fix { get; }
Source
Gets the safe fix guidance.
DurableWorkerRetryability Retryability { get; }
Source
Gets the retry classification for this diagnostic.
IReadOnlyDictionary<string, string> Metadata { get; }
Source
Gets sanitized diagnostic metadata.