# fim-sh/teshter architecture

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

- Interactive diagram: https://gitdiagram.com/fim-sh/teshter
- Repository: https://github.com/fim-sh/teshter

## Overview

Teshter generates commands from test-suite queries, runs those commands in isolated Docker containers, and checks their results with per-test setup and verification scripts. The main process loads and combines suite/test configuration, coordinates parallel generation and execution, then writes aggregated YAML results. The runner prepares a work directory, executes setup, command, and verification stages, and returns a structured report. README documents the Wish and Docker integrations; the graph omits implementation details for the Docker image and unsampled runner deployment.

Main entry points: [`teshter/src/main.rs`](https://github.com/fim-sh/teshter/blob/main/teshter/src/main.rs) (Run Orchestrator), [`teshter-runner/src/main.rs`](https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs) (Runner CLI), [`teshter/src/whale.rs`](https://github.com/fim-sh/teshter/blob/main/teshter/src/whale.rs) (Execution Manager), [`teshter/src/fairy.rs`](https://github.com/fim-sh/teshter/blob/main/teshter/src/fairy.rs) (Generation Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_coordination["Orchestration"]
  node_main["Run Orchestrator<br/>[main.rs]"]
  node_testsuite["Testcase Builder<br/>[testsuite.rs]"]
end

subgraph group_generation["Command Generation"]
  node_fairy_gm["Generation Manager<br/>[fairy.rs]"]
  node_fairy["Command Generator<br/>[fairy.rs]"]
end

subgraph group_execution["Container Execution"]
  node_whale_gm["Execution Manager<br/>[whale.rs]"]
  node_whale["Docker Worker<br/>[whale.rs]"]
end

subgraph group_runner["Test Runner"]
  node_runner["Runner CLI<br/>[main.rs]"]
  node_workdir["Workspace Setup<br/>[main.rs]"]
  node_setup["Test Setup<br/>[main.rs]"]
  node_command["Command Execution<br/>[main.rs]"]
  node_verify["Result Verification<br/>[main.rs]"]
  node_run_command["Process Runner<br/>[utils.rs]"]
end

subgraph group_reporting["Results"]
  node_runner_report["Runner Report<br/>[raport.rs]"]
  node_aggregate["Result Aggregation<br/>[whale.rs]"]
  node_output["YAML Report<br/>[main.rs]"]
end

node_user(("Framework User"))
node_suite_input["Suite Configuration"]
node_test_input["Test Configuration"]
node_wish["Wish LLM Client"]
node_docker["Docker Engine"]

node_user -->|"starts run"| node_main
node_user -->|"provides suite"| node_suite_input
node_user -->|"provides tests"| node_test_input
node_main -->|"loads configuration"| node_suite_input
node_main -->|"loads configuration"| node_test_input
node_main -->|"builds testcases"| node_testsuite
node_testsuite -->|"supplies testcases"| node_fairy_gm
node_testsuite -->|"supplies testcases"| node_whale_gm
node_main -->|"starts generation"| node_fairy_gm
node_main -->|"starts execution"| node_whale_gm
node_fairy_gm -->|"dispatches tasks"| node_fairy
node_fairy -->|"requests commands"| node_wish
node_fairy_gm -->|"sends generated outputs"| node_whale_gm
node_whale_gm -->|"dispatches commands"| node_whale
node_whale -->|"runs container"| node_docker
node_docker -->|"starts runner"| node_runner
node_runner -->|"prepares workspace"| node_workdir
node_runner -->|"runs setup"| node_setup
node_runner -->|"runs tested command"| node_command
node_runner -->|"runs verification"| node_verify
node_workdir -->|"copies files"| node_run_command
node_setup -->|"executes script"| node_run_command
node_command -->|"executes command"| node_run_command
node_verify -->|"executes verifier"| node_run_command
node_runner -->|"constructs report"| node_runner_report
node_whale -->|"parses runner output"| node_runner_report
node_whale_gm -->|"classifies outcomes"| node_aggregate
node_aggregate -->|"returns results"| node_main
node_main -->|"writes YAML"| node_output

click node_main "https://github.com/fim-sh/teshter/blob/main/teshter/src/main.rs"
click node_testsuite "https://github.com/fim-sh/teshter/blob/main/teshter/src/testsuite.rs"
click node_fairy_gm "https://github.com/fim-sh/teshter/blob/main/teshter/src/fairy.rs"
click node_fairy "https://github.com/fim-sh/teshter/blob/main/teshter/src/fairy.rs"
click node_whale_gm "https://github.com/fim-sh/teshter/blob/main/teshter/src/whale.rs"
click node_whale "https://github.com/fim-sh/teshter/blob/main/teshter/src/whale.rs"
click node_runner "https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs"
click node_workdir "https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs"
click node_setup "https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs"
click node_command "https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs"
click node_verify "https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs"
click node_run_command "https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/utils.rs"
click node_runner_report "https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/raport.rs"
click node_aggregate "https://github.com/fim-sh/teshter/blob/main/teshter/src/whale.rs"
click node_output "https://github.com/fim-sh/teshter/blob/main/teshter/src/main.rs"

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_main,node_testsuite,node_user,node_wish toneBlue
class node_fairy_gm,node_fairy toneAmber
class node_whale_gm,node_whale toneMint
class node_runner,node_workdir,node_setup,node_command,node_verify,node_run_command toneRose
class node_runner_report,node_aggregate,node_output,node_suite_input,node_test_input,node_docker toneIndigo
```

## Components

### Orchestration

- [Run Orchestrator](https://github.com/fim-sh/teshter/blob/main/teshter/src/main.rs): `teshter/src/main.rs`
- [Testcase Builder](https://github.com/fim-sh/teshter/blob/main/teshter/src/testsuite.rs): `teshter/src/testsuite.rs`

### Command Generation

- [Generation Manager](https://github.com/fim-sh/teshter/blob/main/teshter/src/fairy.rs): `teshter/src/fairy.rs`
- [Command Generator](https://github.com/fim-sh/teshter/blob/main/teshter/src/fairy.rs): `teshter/src/fairy.rs`

### Container Execution

- [Execution Manager](https://github.com/fim-sh/teshter/blob/main/teshter/src/whale.rs): `teshter/src/whale.rs`
- [Docker Worker](https://github.com/fim-sh/teshter/blob/main/teshter/src/whale.rs): `teshter/src/whale.rs`

### Test Runner

- [Runner CLI](https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs): `teshter-runner/src/main.rs`
- [Workspace Setup](https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs): `teshter-runner/src/main.rs`
- [Test Setup](https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs): `teshter-runner/src/main.rs`
- [Command Execution](https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs): `teshter-runner/src/main.rs`
- [Result Verification](https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/main.rs): `teshter-runner/src/main.rs`
- [Process Runner](https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/utils.rs): `teshter-runner/src/utils.rs`

### Results

- [Runner Report](https://github.com/fim-sh/teshter/blob/main/teshter-runner/src/raport.rs): `teshter-runner/src/raport.rs`
- [Result Aggregation](https://github.com/fim-sh/teshter/blob/main/teshter/src/whale.rs): `teshter/src/whale.rs`
- [YAML Report](https://github.com/fim-sh/teshter/blob/main/teshter/src/main.rs): `teshter/src/main.rs`

### Other components

- **Framework User**
- **Suite Configuration**
- **Test Configuration**
- **Wish LLM Client**
- **Docker Engine**

## Connections

- Framework User → Run Orchestrator: starts run (evidence: `README.md`)
- Framework User → Suite Configuration: provides suite (evidence: `README.md`)
- Framework User → Test Configuration: provides tests
- Run Orchestrator → Suite Configuration: loads configuration (evidence: `teshter/src/main.rs`)
- Run Orchestrator → Test Configuration: loads configuration (evidence: `teshter/src/main.rs`)
- Run Orchestrator → Testcase Builder: builds testcases (evidence: `teshter/src/main.rs`)
- Testcase Builder → Generation Manager: supplies testcases (evidence: `teshter/src/main.rs`)
- Testcase Builder → Execution Manager: supplies testcases (evidence: `teshter/src/main.rs`)
- Run Orchestrator → Generation Manager: starts generation (evidence: `teshter/src/main.rs`)
- Run Orchestrator → Execution Manager: starts execution (evidence: `teshter/src/main.rs`)
- Generation Manager → Command Generator: dispatches tasks (evidence: `teshter/src/fairy.rs`)
- Command Generator → Wish LLM Client: requests commands (evidence: `README.md`)
- Generation Manager → Execution Manager: sends generated outputs (evidence: `teshter/src/main.rs`)
- Execution Manager → Docker Worker: dispatches commands (evidence: `teshter/src/whale.rs`)
- Docker Worker → Docker Engine: runs container (evidence: `teshter/src/whale.rs`)
- Docker Engine → Runner CLI: starts runner (evidence: `README.md`)
- Runner CLI → Workspace Setup: prepares workspace (evidence: `teshter-runner/src/main.rs`)
- Runner CLI → Test Setup: runs setup (evidence: `teshter-runner/src/main.rs`)
- Runner CLI → Command Execution: runs tested command (evidence: `teshter-runner/src/main.rs`)
- Runner CLI → Result Verification: runs verification (evidence: `teshter-runner/src/main.rs`)
- Workspace Setup → Process Runner: copies files (evidence: `teshter-runner/src/main.rs`)
- Test Setup → Process Runner: executes script (evidence: `teshter-runner/src/main.rs`)
- Command Execution → Process Runner: executes command (evidence: `teshter-runner/src/main.rs`)
- Result Verification → Process Runner: executes verifier (evidence: `teshter-runner/src/main.rs`)
- Runner CLI → Runner Report: constructs report (evidence: `teshter-runner/src/main.rs`)
- Docker Worker → Runner Report: parses runner output (evidence: `teshter/src/whale.rs`)
- Execution Manager → Result Aggregation: classifies outcomes (evidence: `teshter/src/whale.rs`)
- Result Aggregation → Run Orchestrator: returns results (evidence: `teshter/src/main.rs`)
- Run Orchestrator → YAML Report: writes YAML (evidence: `teshter/src/main.rs`)
