< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Workflows.GraphTopology
Assembly: NexusLabs.Needlr.AgentFramework.Workflows
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Workflows/GraphTopology.cs
Line coverage
100%
Covered lines: 29
Uncovered lines: 0
Coverable lines: 29
Total lines: 57
Line coverage: 100%
Branch coverage
100%
Covered branches: 14
Total branches: 14
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_EntryType()100%11100%
get_AllTypes()100%11100%
get_JoinModes()100%11100%
get_IncomingTypes()100%11100%
get_InboundEdges()100%11100%
get_OutboundEdges()100%11100%
get_GraphRoutingMode()100%11100%
get_OutgoingEdgesBySource()100%11100%
get_EffectiveRoutingModes()100%11100%
get_EdgeIsRequired()100%11100%
get_ReducerFunc()100%11100%
get_ReducerType()100%11100%
get_HasWaitAnyNodes()100%11100%
get_RequiresNeedlrExecutor()100%88100%
get_HasConditions()100%11100%
get_HasOptionalEdges()100%11100%
get_HasReducer()100%11100%
get_HasNonTrivialRouting()100%66100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Workflows/GraphTopology.cs

#LineLine coverage
 1namespace NexusLabs.Needlr.AgentFramework.Workflows;
 2
 3/// <summary>
 4/// The complete topology of a graph workflow, discovered from attributes at
 5/// runtime. Immutable once built.
 6/// </summary>
 617internal sealed record GraphTopology(
 1398    Type? EntryType,
 2139    HashSet<Type> AllTypes,
 27110    Dictionary<Type, GraphJoinMode> JoinModes,
 22211    Dictionary<Type, List<Type>> IncomingTypes,
 36612    Dictionary<Type, IReadOnlyList<Type>> InboundEdges,
 10113    Dictionary<Type, IReadOnlyList<Type>> OutboundEdges,
 8614    GraphRoutingMode GraphRoutingMode,
 17715    Dictionary<Type, List<GraphEdgeDetail>> OutgoingEdgesBySource,
 7916    Dictionary<Type, GraphRoutingMode> EffectiveRoutingModes,
 5117    Dictionary<(Type Source, Type Target), bool> EdgeIsRequired,
 2318    Func<IReadOnlyList<string>, string>? ReducerFunc,
 6319    Type? ReducerType)
 20{
 21    /// <summary>
 22    /// Whether any node in this graph uses <see cref="GraphJoinMode.WaitAny"/>.
 23    /// </summary>
 24    public bool HasWaitAnyNodes =>
 7725        JoinModes.Values.Any(m => m == GraphJoinMode.WaitAny);
 26
 27    /// <summary>
 28    /// Whether this graph requires the Needlr-native executor instead of the
 29    /// MAF BSP engine. The MAF BSP path only supports unconditional WaitAll
 30    /// graphs with Deterministic/AllMatching routing and no reducers. Any
 31    /// advanced feature forces the Needlr-native executor.
 32    /// </summary>
 33    public bool RequiresNeedlrExecutor =>
 4334        HasWaitAnyNodes ||
 4335        HasConditions ||
 4336        HasOptionalEdges ||
 4337        HasReducer ||
 4338        HasNonTrivialRouting;
 39
 40    private bool HasConditions =>
 2141        OutgoingEdgesBySource.Values
 1742            .SelectMany(edges => edges)
 4143            .Any(e => e.Condition is not null);
 44
 45    private bool HasOptionalEdges =>
 2646        EdgeIsRequired.Values.Any(isReq => !isReq);
 47
 48    private bool HasReducer =>
 1249        ReducerFunc is not null;
 50
 51    private bool HasNonTrivialRouting =>
 952        GraphRoutingMode != GraphRoutingMode.Deterministic &&
 953        GraphRoutingMode != GraphRoutingMode.AllMatching ||
 954        EffectiveRoutingModes.Values.Any(m =>
 1255            m != GraphRoutingMode.Deterministic &&
 1256            m != GraphRoutingMode.AllMatching);
 57}