# vidipt9090/flakeguard architecture

> Architecture diagram of the GitHub repository vidipt9090/flakeguard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vidipt9090/flakeguard
- Repository: https://github.com/vidipt9090/flakeguard

## Overview

FlakeGuard detects and triages flaky tests: a scan runs tests in shuffled permutations, assesses instability, gathers source/evidence, and presents findings for follow-up. Its primary workflow is visible in the scan orchestrator and runner modules; the README documents semantic navigation and local-LLM analysis as additional stages. The console and older dashboard expose run and analysis views. Some major subsystems are documented but unsampled, so their internal wiring is omitted; dashed edges mark documented high-level relationships rather than inspected calls.

Main entry points: [`flakeguard/runner/orchestrator.py`](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/orchestrator.py) (Scan orchestrator), [`flakeguard/runner/matrix.py`](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/matrix.py) (Shuffled run matrix), [`flakeguard/navigator/ast_nav.py`](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/navigator/ast_nav.py) (AST navigator), [`flakeguard/navigator/knowledge_tree.py`](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/navigator/knowledge_tree.py) (Knowledge tree)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scan["Scan and execution"]
  node_scan_orchestrator["Scan orchestrator<br/>[orchestrator.py]"]
  node_matrix_runner["Shuffled run matrix<br/>[matrix.py]"]
  node_sandbox["Execution sandbox<br/>[sandbox.py]"]
  node_run_events["Run events<br/>[events.py]"]
end

subgraph group_analysis["Diagnosis and analysis"]
  node_flakiness_detector["Flakiness detector<br/>[detector.py]"]
  node_evidence_engine["Evidence diagnosis<br/>[engine.py]"]
  node_navigator["AST navigator<br/>[ast_nav.py]"]
  node_knowledge_tree["Knowledge tree<br/>[knowledge_tree.py]"]
  node_trace["Navigation trace<br/>[trace.py]"]
  node_retrieval["Source retrieval"]
  node_llm["Local LLM analysis"]
  node_contracts["Shared result contracts<br/>[contracts.py]"]
end

subgraph group_console["Console experience"]
  node_console_ui["React console<br/>[App.tsx]"]
  node_console_pages["Run and finding views"]
  node_console_api["Console API client<br/>[client.ts]"]
  node_api_server["HTTP API<br/>[api.py]"]
  node_console_routes["Console routes<br/>[routes.py]"]
end

subgraph group_dashboard["Dashboard experience"]
  node_legacy_dashboard["Streamlit dashboard<br/>[dashboard.py]"]
  node_frontend_dashboard["Older React dashboard<br/>[App.tsx]"]
  node_triage_view["Triage view<br/>[TriageView.tsx]"]
  node_navigator_view["Navigator replay view<br/>[NavigatorView.tsx]"]
end

node_developer(("Developer"))

node_developer -.->|"starts scan"| node_console_ui
node_console_ui -->|"routes to"| node_console_pages
node_console_pages -->|"requests data"| node_console_api
node_console_api -.->|"calls HTTP API"| node_api_server
node_api_server -.->|"serves routes"| node_console_routes
node_console_routes -->|"starts scans"| node_scan_orchestrator
node_scan_orchestrator -->|"runs matrix"| node_matrix_runner
node_matrix_runner -->|"executes tests"| node_sandbox
node_matrix_runner -->|"records events"| node_run_events
node_scan_orchestrator -->|"classifies outcomes"| node_flakiness_detector
node_scan_orchestrator -->|"navigates source"| node_navigator
node_scan_orchestrator -->|"builds tree"| node_knowledge_tree
node_navigator -->|"builds knowledge tree"| node_knowledge_tree
node_navigator -->|"records steps"| node_trace
node_knowledge_tree -->|"uses trace"| node_trace
node_scan_orchestrator -.->|"returns scan result"| node_contracts
node_evidence_engine -->|"runs interventions"| node_sandbox
node_evidence_engine -->|"produces report"| node_contracts
node_retrieval -.->|"supplies source context"| node_llm
node_llm -.->|"explains findings"| node_console_pages
node_legacy_dashboard -.->|"offers replay"| node_navigator_view
node_frontend_dashboard -->|"shows triage"| node_triage_view
node_frontend_dashboard -.->|"opens navigator"| node_navigator_view

click node_console_ui "https://github.com/vidipt9090/flakeguard/blob/main/console/src/App.tsx"
click node_console_pages "https://github.com/vidipt9090/flakeguard/tree/main/console/src/pages"
click node_console_api "https://github.com/vidipt9090/flakeguard/blob/main/console/src/api/client.ts"
click node_api_server "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/app/api.py"
click node_console_routes "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/console/routes.py"
click node_scan_orchestrator "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/orchestrator.py"
click node_matrix_runner "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/matrix.py"
click node_sandbox "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/sandbox.py"
click node_run_events "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/events.py"
click node_flakiness_detector "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/detector.py"
click node_evidence_engine "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/evidence/engine.py"
click node_navigator "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/navigator/ast_nav.py"
click node_knowledge_tree "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/navigator/knowledge_tree.py"
click node_trace "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/navigator/trace.py"
click node_retrieval "https://github.com/vidipt9090/flakeguard/tree/main/flakeguard/retrieval"
click node_llm "https://github.com/vidipt9090/flakeguard/tree/main/flakeguard/llm"
click node_contracts "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/contracts.py"
click node_legacy_dashboard "https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/app/dashboard.py"
click node_frontend_dashboard "https://github.com/vidipt9090/flakeguard/blob/main/frontend/src/App.tsx"
click node_triage_view "https://github.com/vidipt9090/flakeguard/blob/main/frontend/src/TriageView.tsx"
click node_navigator_view "https://github.com/vidipt9090/flakeguard/blob/main/frontend/src/NavigatorView.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scan_orchestrator,node_matrix_runner,node_sandbox,node_run_events toneBlue
class node_flakiness_detector,node_evidence_engine,node_navigator,node_knowledge_tree,node_trace,node_retrieval,node_llm,node_contracts toneAmber
class node_console_ui,node_console_pages,node_console_api,node_api_server,node_console_routes toneMint
class node_legacy_dashboard,node_frontend_dashboard,node_triage_view,node_navigator_view toneRose
class node_developer toneIndigo
```

## Components

### Scan and execution

- [Scan orchestrator](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/orchestrator.py): `flakeguard/runner/orchestrator.py`
- [Shuffled run matrix](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/matrix.py): `flakeguard/runner/matrix.py`
- [Execution sandbox](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/sandbox.py): `flakeguard/runner/sandbox.py`
- [Run events](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/events.py): `flakeguard/runner/events.py`

### Diagnosis and analysis

- [Flakiness detector](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/runner/detector.py): `flakeguard/runner/detector.py`
- [Evidence diagnosis](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/evidence/engine.py): `flakeguard/evidence/engine.py`
- [AST navigator](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/navigator/ast_nav.py): `flakeguard/navigator/ast_nav.py`
- [Knowledge tree](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/navigator/knowledge_tree.py): `flakeguard/navigator/knowledge_tree.py`
- [Navigation trace](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/navigator/trace.py): `flakeguard/navigator/trace.py`
- [Source retrieval](https://github.com/vidipt9090/flakeguard/tree/main/flakeguard/retrieval): `flakeguard/retrieval`
- [Local LLM analysis](https://github.com/vidipt9090/flakeguard/tree/main/flakeguard/llm): `flakeguard/llm`
- [Shared result contracts](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/contracts.py): `flakeguard/contracts.py`

### Console experience

- [React console](https://github.com/vidipt9090/flakeguard/blob/main/console/src/App.tsx): `console/src/App.tsx`
- [Run and finding views](https://github.com/vidipt9090/flakeguard/tree/main/console/src/pages): `console/src/pages`
- [Console API client](https://github.com/vidipt9090/flakeguard/blob/main/console/src/api/client.ts): `console/src/api/client.ts`
- [HTTP API](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/app/api.py): `flakeguard/app/api.py`
- [Console routes](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/console/routes.py): `flakeguard/console/routes.py`

### Dashboard experience

- [Streamlit dashboard](https://github.com/vidipt9090/flakeguard/blob/main/flakeguard/app/dashboard.py): `flakeguard/app/dashboard.py`
- [Older React dashboard](https://github.com/vidipt9090/flakeguard/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Triage view](https://github.com/vidipt9090/flakeguard/blob/main/frontend/src/TriageView.tsx): `frontend/src/TriageView.tsx`
- [Navigator replay view](https://github.com/vidipt9090/flakeguard/blob/main/frontend/src/NavigatorView.tsx): `frontend/src/NavigatorView.tsx`

### Other components

- **Developer**

## Connections

- Developer → React console: starts scan (evidence: `README.md`)
- React console → Run and finding views: routes to (evidence: `console/src/App.tsx`)
- Run and finding views → Console API client: requests data (evidence: `console/src/pages/Findings.tsx`)
- Console API client → HTTP API: calls HTTP API (evidence: `README.md`)
- HTTP API → Console routes: serves routes (evidence: `README.md`)
- Console routes → Scan orchestrator: starts scans (evidence: `flakeguard/console/routes.py`)
- Scan orchestrator → Shuffled run matrix: runs matrix (evidence: `flakeguard/runner/orchestrator.py`)
- Shuffled run matrix → Execution sandbox: executes tests (evidence: `flakeguard/runner/matrix.py`)
- Shuffled run matrix → Run events: records events (evidence: `flakeguard/runner/matrix.py`)
- Scan orchestrator → Flakiness detector: classifies outcomes (evidence: `flakeguard/runner/orchestrator.py`)
- Scan orchestrator → AST navigator: navigates source (evidence: `flakeguard/runner/orchestrator.py`)
- Scan orchestrator → Knowledge tree: builds tree (evidence: `flakeguard/runner/orchestrator.py`)
- AST navigator → Knowledge tree: builds knowledge tree (evidence: `flakeguard/navigator/ast_nav.py`)
- AST navigator → Navigation trace: records steps (evidence: `flakeguard/navigator/ast_nav.py`)
- Knowledge tree → Navigation trace: uses trace (evidence: `flakeguard/navigator/knowledge_tree.py`)
- Scan orchestrator → Shared result contracts: returns scan result
- Evidence diagnosis → Execution sandbox: runs interventions (evidence: `flakeguard/evidence/engine.py`)
- Evidence diagnosis → Shared result contracts: produces report (evidence: `flakeguard/evidence/engine.py`)
- Source retrieval → Local LLM analysis: supplies source context (evidence: `README.md`)
- Local LLM analysis → Run and finding views: explains findings (evidence: `README.md`)
- Streamlit dashboard → Navigator replay view: offers replay (evidence: `README.md`)
- Older React dashboard → Triage view: shows triage (evidence: `frontend/src/App.tsx`)
- Older React dashboard → Navigator replay view: opens navigator (evidence: `README.md`)
