Error auto-enrichment (non-overwriting)
When a pipeline step produces an error, ResultContext fields are automatically injected as tags — without overwriting tags already set by the error's factory:
var result = Result<Order>.Ok(order)
.WithContext(entityId: "42", correlationId: "trace-1", tenantId: "t-1")
.Ensure(_ => false, new Error("guard failed"));
var error = result.Errors[0];
error.Tags["Entity"] // "Order" ← from context
error.Tags["EntityId"] // "42" ← from context
error.Tags["CorrelationId"] // "trace-1" ← from context
error.Tags["TenantId"] // "t-1" ← from context
If the error's factory already set a tag, context does not overwrite it:
var factoryError = new Error("conflict")
.WithTag(DomainTags.Entity, "FactoryEntity"); // set by factory
// Ensure produces this error — context enrichment:
error.Tags["Entity"] // "FactoryEntity" ← factory tag wins
error.Tags["EntityId"] // "42" ← filled from context (was missing)