Module: pipeline/flowGraph

Extracts meaningful user flows from an explored state graph.

After the state explorer has built a graph of (state, action) → state transitions, this module analyses it to produce:

  • Terminal flows — paths from the start state to a "terminal" state (success confirmation, error, different page section)
  • Form flows — sequences that fill fields then submit
  • Navigation flows — multi-page traversals via link clicks

Each extracted flow is a sequence of observed { state, action, resultState } triples that can be fed directly to the journey prompt for test generation.

Exports

  • extractFlows(stateGraph) → Flow[]
  • flowToJourney(flow, snapshotsByFingerprint) → journey object
Source:

Methods

(static) extractFlows(stateGraph) → {Array.<{name: string, type: string, path: Array.<{fromFp: string, action: object, toFp: string}>, description: string, _discoveredBy: string}>}

Extract meaningful user flows from the state graph.

Parameters:
Name Type Description
stateGraph object

{ states: Set, edges: Array, startState: string, snapshotsByFp: Map }

Source:
Returns:
Type
Array.<{name: string, type: string, path: Array.<{fromFp: string, action: object, toFp: string}>, description: string, _discoveredBy: string}>

(static) flowToJourney(flow, snapshotsByFp) → {object}

Convert an extracted flow into a journey object compatible with the existing module:pipeline/journeyGenerator.generateJourneyTest interface.

The existing journey system expects { name, type, pages[], description }. We map each unique state in the flow to a "page" entry, and attach the observed action sequence as _observedActions for the enhanced prompt.

Parameters:
Name Type Description
flow object

— from extractFlows()

snapshotsByFp Map.<string, object>

— fingerprint → snapshot

Source:
Returns:

journey object for journeyGenerator

Type
object

(inner) classifyFlow(path) → {string}

Classify a flow based on the actions it contains.

Parameters:
Name Type Description
path Array

— array of edge objects

Source:
Returns:

flow type: "AUTH" | "FORM_SUBMISSION" | "SEARCH" | "NAVIGATION" | "CRUD"

Type
string

(inner) deduplicateFlows(paths) → {Array}

Deduplicate flows that traverse the same sequence of states.

Parameters:
Name Type Description
paths Array
Source:
Returns:
Type
Array

(inner) findPaths(stateGraph, maxDepthopt) → {Array.<Array.<{fromFp: string, action: object, toFp: string}>>}

Find all distinct paths from the start state to states with no outgoing edges (terminal states) or states that loop back to an earlier state.

Uses iterative DFS with a depth limit to avoid combinatorial explosion.

Parameters:
Name Type Attributes Default Description
stateGraph object

{ states, edges, startState, snapshotsByFp }

maxDepth number <optional>
6

— maximum path length

Source:
Returns:
Type
Array.<Array.<{fromFp: string, action: object, toFp: string}>>