# `Excessibility.TelemetryCapture.Analyzers.StateMachine`
[🔗](https://github.com/lessthanseventy/excessibility/blob/v0.18.1/lib/telemetry_capture/analyzers/state_machine.ex#L1)

Analyzes state transitions across timeline events.

Detects:
- Keys added between events
- Keys removed between events
- Rapid state changes (many transitions)
- Unstable state (keys added then removed)

Uses data from the State enricher (state_keys) to track how the
assign keys change over time.

## Algorithm

1. Compare state_keys between consecutive events
2. Identify added and removed keys
3. Detect patterns:
   - Rapid changes: 3+ transitions with changes
   - Unstable state: Keys that appear and then disappear
4. Calculate summary statistics

## Output

Returns findings and statistics:

    %{
      findings: [
        %{
          severity: :info,
          message: "2 keys added between events 1→2",
          events: [1, 2],
          metadata: %{added: [:products, :cart], removed: []}
        }
      ],
      stats: %{
        total_transitions: 4,
        total_keys_added: 5,
        total_keys_removed: 2
      }
    }

# `analyze`

# `default_enabled?`

# `name`

# `requires_enrichers`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
