Cross-Method Pipeline Tracing β `MaxDepth` (v1.45.0)
When a Bind lambda delegates to another method in the same project, [ResultFlow] can follow the call and expand it inline as a Mermaid subgraph β giving you a single diagram that spans multiple methods.
[ResultFlow(MaxDepth = 2)]
public Result<OrderDto> PlaceOrder(CreateOrderCmd cmd) =>
CreateOrder(cmd)
.Bind(o => ValidateOrder(o)) // β ResultFlow traces into ValidateOrder
.Map(ToDto);
// Same class β ResultFlow walks this body and nests it as a subgraph:
static Result<Order> ValidateOrder(Order o) =>
Result<Order>.Ok(o)
.Ensure(x => x.Id > 0, new ValidationError("Id", "Required"))
.Ensure(x => x.Total > 0m, new ValidationError("Total", "Must be positive"));
Generated Mermaid β ValidateOrder is expanded as a named subgraph, connected to the outer pipeline with -->|ok|:
flowchart LR
N0_CreateOrder["CreateOrder<br/>Order"]:::operation
N0_CreateOrder -->|ok| sg_N1_ValidateOrder
subgraph sg_N1_ValidateOrder["ValidateOrder"]
ENTRY_N1_ValidateOrder[ ]:::entry
ENTRY_N1_ValidateOrder[ ] ==> N1_ValidateOrder_0_Ensure
N1_ValidateOrder_0_Ensure["Ensure<br/>Order"]:::gatekeeper
N1_ValidateOrder_0_Ensure -->|pass| N1_ValidateOrder_1_Ensure
N1_ValidateOrder_0_Ensure -->|"ValidationError"| FAIL
N1_ValidateOrder_1_Ensure["Ensure<br/>Order"]:::gatekeeper
N1_ValidateOrder_1_Ensure -->|"ValidationError"| FAIL
end
sg_N1_ValidateOrder -->|ok| N2_Map
N2_Map["Map<br/>OrderDto"]:::transform
FAIL([fail]):::failure
classDef entry fill:none,stroke:none
MaxDepth controls how deep tracing follows nested calls. The default is 2; set to 0 to disable cross-method expansion entirely.
| Value | Behaviour |
|---|---|
MaxDepth = 0 |
No cross-method tracing β Bind nodes stay as leaf boxes |
MaxDepth = 1 |
Only the first level of called methods is expanded |
MaxDepth = 2 (default) |
Two levels of nesting β covers most real-world pipelines |
Cycle guard β mutual recursion terminates cleanly. If method A expands into method B which calls A again, the second visit is suppressed (the current call-stack path is tracked, not a global visited set β so the same method can expand in sibling branches).
Ambiguity guard (
REslava.ResultFlowonly) β if two or more methods share the same name, cross-method tracing is skipped for that node to avoid false positives.