failcast 0.1.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: failcast
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Programming Language :: Rust
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Topic :: Software Development :: Testing
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Summary: Local Rust CLI and MCP server that predicts which pytest tests will fail for a git diff
|
|
13
|
+
Keywords: pytest,testing,mcp,gbdt,machine-learning,predictive-testing
|
|
14
|
+
Home-Page: https://github.com/AL3XPI/failcast
|
|
15
|
+
License: MIT
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
18
|
+
Project-URL: Homepage, https://github.com/AL3XPI/failcast
|
|
19
|
+
Project-URL: Issues, https://github.com/AL3XPI/failcast/issues
|
|
20
|
+
Project-URL: Repository, https://github.com/AL3XPI/failcast
|
|
21
|
+
|
|
22
|
+
# failcast
|
|
23
|
+
|
|
24
|
+
[](https://github.com/AL3XPI/failcast/actions/workflows/ci.yml)
|
|
25
|
+
[](https://github.com/AL3XPI/failcast/releases)
|
|
26
|
+

|
|
27
|
+
[](LICENSE)
|
|
28
|
+
|
|
29
|
+
`failcast` is a local Rust CLI and stdio MCP server that reads your working-tree `git diff`, predicts which `pytest` tests are likely to fail, runs the highest-yield ones inside a time or count budget, and stores every outcome in SQLite so future runs get sharper. Everything compiles into one Rust binary (Edition 2024) backed by statically linked bundled `rusqlite`, pure-Rust `forust-ml` gradient-boosted trees with Platt calibration, and a `tree-sitter` file-level Python import graph.
|
|
30
|
+
|
|
31
|
+
The selector ranks candidate tests by calibrated failure probability per millisecond (`prob / eff_ms`). A small deterministic exploration pass appends stale tests on top of the greedy budget so neglected parts of the suite stay measured, while inverse-propensity weighting corrects training rows for selection bias. Training and evaluation splits follow chronological run boundaries (`max_train_ts < min_cal_ts < min_eval_ts`) to keep future outcomes out of earlier feature snapshots. One shared internal service layer drives both the CLI (`failcast run`, `failcast explain`) and the `rmcp` stdio MCP server (`failcast mcp`).
|
|
32
|
+
|
|
33
|
+
## Install & Quickstart
|
|
34
|
+
|
|
35
|
+
Download a prebuilt binary for macOS (`aarch64-apple-darwin`), Linux (`x86_64-unknown-linux-gnu`), or Windows (`x86_64-pc-windows-msvc`) from [GitHub Releases](https://github.com/AL3XPI/failcast/releases) (verify with `SHA256SUMS.txt` if desired):
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# macOS (Apple Silicon)
|
|
39
|
+
curl -fsSL https://github.com/AL3XPI/failcast/releases/latest/download/failcast-v0.1.0-aarch64-apple-darwin.tar.gz \
|
|
40
|
+
| tar -xz -C ~/.local/bin
|
|
41
|
+
|
|
42
|
+
# Linux (x86_64)
|
|
43
|
+
curl -fsSL https://github.com/AL3XPI/failcast/releases/latest/download/failcast-v0.1.0-x86_64-unknown-linux-gnu.tar.gz \
|
|
44
|
+
| tar -xz -C ~/.local/bin
|
|
45
|
+
|
|
46
|
+
# Windows (PowerShell)
|
|
47
|
+
Invoke-WebRequest https://github.com/AL3XPI/failcast/releases/latest/download/failcast-v0.1.0-x86_64-pc-windows-msvc.zip -OutFile failcast.zip
|
|
48
|
+
Expand-Archive failcast.zip -DestinationPath "$env:USERPROFILE\.local\bin" -Force
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
You can also build from source with Rust 1.88+ (Edition 2024, tested on `rustc 1.98.1`):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/AL3XPI/failcast.git
|
|
55
|
+
cargo install --path failcast/crates/failcast-cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Once registry publishing is enabled for `failcast`, `cargo install failcast` (crates.io) and `uvx failcast` / `pipx install failcast` (PyPI binary wheels via `maturin`) will also work directly without building locally.
|
|
59
|
+
|
|
60
|
+
Running tests requires `pytest` on your `PATH` (or configured in `.failcast.toml`). Add `.failcast/` to your repository's `.gitignore`, initialize the local SQLite store, and seed a baseline run:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Initialize .failcast/store.db and mine recent git history for co-change and 30-day churn
|
|
64
|
+
failcast init --history-limit 500
|
|
65
|
+
|
|
66
|
+
# Run the full suite once to seed durations and baseline pass/fail history
|
|
67
|
+
failcast run --all
|
|
68
|
+
|
|
69
|
+
# Select and run highest-value tests within a 15-second budget
|
|
70
|
+
failcast run --budget 15
|
|
71
|
+
|
|
72
|
+
# Preview selection without executing tests or writing runs to SQLite (uses discovery cache)
|
|
73
|
+
failcast run --budget 15 --dry-run --json
|
|
74
|
+
|
|
75
|
+
# Force fresh pytest --collect-only discovery (bypasses the SQLite cache)
|
|
76
|
+
failcast run --budget 15 --dry-run --refresh-tests --json
|
|
77
|
+
|
|
78
|
+
# Alternative selection modes
|
|
79
|
+
failcast run --top-k 20
|
|
80
|
+
failcast run --target-recall 0.95
|
|
81
|
+
|
|
82
|
+
# Train the GBDT + Platt model once history crosses thresholds (writes .failcast/model.json)
|
|
83
|
+
failcast train
|
|
84
|
+
|
|
85
|
+
# Inspect all 16 features, active model mode, calibrated probability, yield score, and top signals
|
|
86
|
+
failcast explain tests/test_calc.py::test_add_positive
|
|
87
|
+
failcast explain tests/test_calc.py::test_add_positive --json
|
|
88
|
+
|
|
89
|
+
# Replay stored runs chronologically against Random, StaticAst, and RecentFailureRate
|
|
90
|
+
failcast eval --budgets 0.1,0.2,0.3 --min-train-runs 20 --retrain-every 5 --output-json eval_report.json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
When tests fail, `failcast run` still parses the JUnit XML and commits every outcome to `.failcast/store.db` before returning `pytest`'s non-zero exit code. Until stored history crosses `min_runs_for_ml = 100` and `min_failures_for_ml = 25` (both configurable in `.failcast.toml`), `failcast` ranks with a cold-start heuristic.
|
|
94
|
+
|
|
95
|
+
<details>
|
|
96
|
+
<summary>Configuration & history import (.failcast.toml, backfill, JSONL)</summary>
|
|
97
|
+
|
|
98
|
+
Every key in `.failcast.toml` is optional. Copy `.failcast.toml.example` to `.failcast.toml` at your repository root to override any default:
|
|
99
|
+
|
|
100
|
+
```toml
|
|
101
|
+
runner = "pytest"
|
|
102
|
+
default_budget_secs = 15
|
|
103
|
+
explore_fraction = 0.10
|
|
104
|
+
min_failures_for_ml = 25
|
|
105
|
+
min_runs_for_ml = 100
|
|
106
|
+
history_commit_limit = 500
|
|
107
|
+
pytest_bin = "pytest"
|
|
108
|
+
max_traceback_chars = 1500
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
You can populate history from recent commits inside an isolated temporary git worktree so your working tree stays untouched, or load external CI and PR failure logs from a JSONL file in a single SQLite transaction (`mode = 'backfill'`):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
failcast backfill --commits 50 --ref HEAD
|
|
115
|
+
failcast import-runs ci_history.jsonl
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{"commit_sha":"a1b2c3d","started_at":1710000000,"diff_files":[{"path":"src/calc.py","lines_added":18,"lines_deleted":2}],"outcomes":[{"test_id":"tests/test_calc.py::test_divide_broken","file_path":"tests/test_calc.py","status":"fail","duration_ms":130}]}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
</details>
|
|
123
|
+
|
|
124
|
+
## Benchmarks
|
|
125
|
+
|
|
126
|
+
Real pre-merge Pull Request runs from [`PyGithub/PyGithub`](https://github.com/PyGithub/PyGithub) (`CI` workflow, 2026-09-09 to 2026-11-20) were collected with [`scripts/collect_gha_pytest.py`](scripts/collect_gha_pytest.py). The dataset contains 80 PR runs total (22 warmup runs followed by 58 strictly chronological evaluated runs with zero timestamp leakage verified on every step), 19 failing PRs overall (13 failing runs and 335 individual test failures in the evaluation window), 1,405 unique `pytest` tests, and 93,736 total outcomes (68,695 evaluated non-skip outcomes). Every per-test duration comes directly from GitHub Actions JUnit XML (`pytest.xml`) workflow artifacts (`0.0%` estimated; 2 zero-pass environment/collection-crash runs excluded). Evaluation trains a 150-tree depth-5 `forust-ml` GBDT with chronological Platt calibration every 5 runs (`gbdt_steps = 58 / 58`), setting `explore_fraction = 0.0` offline so all five strategies compete strictly on ranking and cost-aware packing while live CLI and MCP runs keep exploration enabled. Full JSON output lives in [`docs/benchmarks/eval_report.json`](docs/benchmarks/eval_report.json).
|
|
127
|
+
|
|
128
|
+

|
|
129
|
+
|
|
130
|
+
### 20% Duration Budget (`PyGithub/PyGithub`, 58 Evaluated Runs, 13 Failing Runs)
|
|
131
|
+
|
|
132
|
+
| Budget | Strategy | Commit FDR | Failure Recall | Time Saved | Brier Score | PR-AUC |
|
|
133
|
+
| ---: | :--- | ---: | ---: | ---: | ---: | ---: |
|
|
134
|
+
| **20%** | **Failcast (GBDT+Platt)** | **76.9%** | **93.7%** | **89.8%** | **0.0040** | **0.6894** |
|
|
135
|
+
| 20% | Heuristic | 61.5% | 14.6% | 92.8% | 0.2035 | 0.0115 |
|
|
136
|
+
| 20% | StaticAst | 61.5% | 15.2% | 92.3% | 0.1424 | 0.0059 |
|
|
137
|
+
| 20% | RecentFailureRate | 69.2% | 52.5% | 89.8% | 0.0042 | 0.3085 |
|
|
138
|
+
| 20% | Random | 38.5% | 13.4% | 91.1% | 0.3304 | 0.0051 |
|
|
139
|
+
|
|
140
|
+
At a 20% duration budget (89.8% wall-clock time saved), Failcast catches 93.7% of individual test failures with a 0.6894 PR-AUC (135× Random, 60× Heuristic, 2.23× `RecentFailureRate`). Every strategy's Commit FDR curve stays monotonically non-decreasing as the budget grows.
|
|
141
|
+
|
|
142
|
+
<details>
|
|
143
|
+
<summary>Full multi-budget table (5%–50%)</summary>
|
|
144
|
+
|
|
145
|
+
| Budget | Strategy | Commit FDR | Failure Recall | Time Saved | Brier Score | PR-AUC |
|
|
146
|
+
| ---: | :--- | ---: | ---: | ---: | ---: | ---: |
|
|
147
|
+
| **5%** | **Failcast (GBDT+Platt)** | **53.8%** | **26.6%** | **97.6%** | **0.0040** | **0.6894** |
|
|
148
|
+
| 5% | Heuristic | 46.2% | 6.3% | 98.8% | 0.2035 | 0.0115 |
|
|
149
|
+
| 5% | StaticAst | 38.5% | 5.1% | 98.8% | 0.1424 | 0.0059 |
|
|
150
|
+
| 5% | RecentFailureRate | 61.5% | 18.2% | 97.2% | 0.0042 | 0.3085 |
|
|
151
|
+
| 5% | Random | 30.8% | 3.0% | 97.9% | 0.3304 | 0.0051 |
|
|
152
|
+
| **10%** | **Failcast (GBDT+Platt)** | **69.2%** | **54.6%** | **94.9%** | **0.0040** | **0.6894** |
|
|
153
|
+
| 10% | Heuristic | 46.2% | 9.0% | 97.0% | 0.2035 | 0.0115 |
|
|
154
|
+
| 10% | StaticAst | 38.5% | 5.4% | 97.2% | 0.1424 | 0.0059 |
|
|
155
|
+
| 10% | RecentFailureRate | 69.2% | 30.1% | 94.9% | 0.0042 | 0.3085 |
|
|
156
|
+
| 10% | Random | 38.5% | 7.2% | 95.7% | 0.3304 | 0.0051 |
|
|
157
|
+
| **15%** | **Failcast (GBDT+Platt)** | **76.9%** | **80.0%** | **92.3%** | **0.0040** | **0.6894** |
|
|
158
|
+
| 15% | Heuristic | 53.8% | 12.2% | 95.0% | 0.2035 | 0.0115 |
|
|
159
|
+
| 15% | StaticAst | 53.8% | 11.0% | 94.9% | 0.1424 | 0.0059 |
|
|
160
|
+
| 15% | RecentFailureRate | 69.2% | 41.2% | 92.6% | 0.0042 | 0.3085 |
|
|
161
|
+
| 15% | Random | 38.5% | 10.4% | 93.4% | 0.3304 | 0.0051 |
|
|
162
|
+
| **20%** | **Failcast (GBDT+Platt)** | **76.9%** | **93.7%** | **89.8%** | **0.0040** | **0.6894** |
|
|
163
|
+
| 20% | Heuristic | 61.5% | 14.6% | 92.8% | 0.2035 | 0.0115 |
|
|
164
|
+
| 20% | StaticAst | 61.5% | 15.2% | 92.3% | 0.1424 | 0.0059 |
|
|
165
|
+
| 20% | RecentFailureRate | 69.2% | 52.5% | 89.8% | 0.0042 | 0.3085 |
|
|
166
|
+
| 20% | Random | 38.5% | 13.4% | 91.1% | 0.3304 | 0.0051 |
|
|
167
|
+
| **30%** | **Failcast (GBDT+Platt)** | **76.9%** | **94.3%** | **83.6%** | **0.0040** | **0.6894** |
|
|
168
|
+
| 30% | Heuristic | 69.2% | 16.7% | 88.5% | 0.2035 | 0.0115 |
|
|
169
|
+
| 30% | StaticAst | 61.5% | 19.1% | 87.9% | 0.1424 | 0.0059 |
|
|
170
|
+
| 30% | RecentFailureRate | 69.2% | 56.4% | 83.9% | 0.0042 | 0.3085 |
|
|
171
|
+
| 30% | Random | 53.8% | 20.6% | 86.3% | 0.3304 | 0.0051 |
|
|
172
|
+
| **50%** | **Failcast (GBDT+Platt)** | **76.9%** | **95.5%** | **71.3%** | **0.0040** | **0.6894** |
|
|
173
|
+
| 50% | Heuristic | 69.2% | 23.9% | 78.9% | 0.2035 | 0.0115 |
|
|
174
|
+
| 50% | StaticAst | 69.2% | 28.1% | 79.2% | 0.1424 | 0.0059 |
|
|
175
|
+
| 50% | RecentFailureRate | 69.2% | 62.7% | 70.6% | 0.0042 | 0.3085 |
|
|
176
|
+
| 50% | Random | 53.8% | 30.1% | 76.2% | 0.3304 | 0.0051 |
|
|
177
|
+
|
|
178
|
+
</details>
|
|
179
|
+
|
|
180
|
+
## Systems Latency & Footprint
|
|
181
|
+
|
|
182
|
+
Measured on an Apple M3 Pro (macOS arm64, `rustc 1.98.1 (48a229cea 2026-09-01)`) against [`PyGithub/PyGithub`](https://github.com/PyGithub/PyGithub) with 1,232 discovered tests, 93,736 stored outcomes, and `model_mode = gbdt`. Raw measurements are saved in [`docs/benchmarks/systems_bench.json`](docs/benchmarks/systems_bench.json).
|
|
183
|
+
|
|
184
|
+
| Execution Path | Metric | Value | Notes |
|
|
185
|
+
| :--- | :--- | ---: | :--- |
|
|
186
|
+
| **Binary Footprint** | Stripped release binary (`failcast`) | **8.26 MB** | Unstripped: 10.55 MB (static SQLite + `forust-ml` GBDT + Tree-sitter + `rmcp`) |
|
|
187
|
+
| **Warm Rust Core** | `failcast run --budget 15 --dry-run --json` (p50 / p95) | **398.3 ms / 503.1 ms** | Cached SQLite discovery (**2.2× faster** than cold; `git diff` + SQLite + AST + GBDT+Platt) |
|
|
188
|
+
| **Warm Rust Core** | `failcast explain <test_id> --json` (p50 / p95) | **357.2 ms / 364.6 ms** | Cached SQLite discovery (**2.4× faster** than cold; 16 features + signals + Platt prob) |
|
|
189
|
+
| **Cold `pytest` Discovery** | `failcast run --budget 15 --dry-run --refresh-tests --json` (p50 / p95) | **874.3 ms / 925.3 ms** | Includes external Python + `pytest --collect-only` startup across 1,232 tests |
|
|
190
|
+
| **Cold `pytest` Discovery** | `failcast explain <test_id> --refresh-tests --json` (p50 / p95) | **865.4 ms / 899.7 ms** | Includes external Python + `pytest --collect-only` startup |
|
|
191
|
+
| **Pure ML Core** | `failcast-ml` scoring latency (1,000 tests, p50 / p95) | **1.10 ms / 1.50 ms** | **905,182 tests/sec** (150-tree GBDT + Platt calibration via `bench_infer`) |
|
|
192
|
+
|
|
193
|
+
<details>
|
|
194
|
+
<summary>Probability Calibration Reliability</summary>
|
|
195
|
+
|
|
196
|
+
Across all 68,695 evaluated non-skip outcomes, Platt calibration with the support and log-loss guardrail pulls Brier score down from `0.0041` (raw GBDT) to `0.0040`, a 3.5% drop and the lowest of the five strategies, while removing raw GBDT's overconfident `[0.3, 1.0]` tail bins.
|
|
197
|
+
|
|
198
|
+

|
|
199
|
+
|
|
200
|
+
</details>
|
|
201
|
+
|
|
202
|
+
<details>
|
|
203
|
+
<summary>Implementation Notes</summary>
|
|
204
|
+
|
|
205
|
+
Spawning Python and `pytest --collect-only` on `PyGithub/PyGithub` burns roughly 500 ms before Rust does any work, and heavier Python dependency graphs easily hit 1.5 to 2 seconds. Hashing test and pytest config file metadata into SQLite (`repo_meta["discovery_fingerprint"]`) keeps repeat `failcast run` and `failcast explain` calls inside Rust at 357 to 398 ms p50 end-to-end (with 1.10 ms per 1,000 tests spent in GBDT+Platt scoring) and invalidates automatically whenever a test or pytest config file changes.
|
|
206
|
+
|
|
207
|
+
Wall-clock time saved exceeds `1 - budget` on fast unit suites because the selector clamps every test's effective duration to at least 50 ms (`MIN_EFF_DURATION_MS = 50.0`). Without that floor, sub-millisecond tests get huge `prob / dur` yield ratios and crowd out slower tests that actually break. `PyGithub`'s unit tests have a 20 to 30 ms median runtime, so a 20% nominal budget picks fewer ultra-fast tests than `20% / 25ms`, saving 89.8% of actual wall-clock time while catching 93.7% of individual failures.
|
|
208
|
+
|
|
209
|
+
Real CI histories have heavy class imbalance, often under 0.5% failing executions, so a fixed trailing 20% calibration window frequently hits zero or one failing run and squashes predicted probabilities. Expanding the calibration window backward down to a 60% training floor (while keeping `max_train_ts < min_cal_ts`) until at least 5 positives across at least 2 failing runs appear, and falling back to an identity sigmoid (`a = 1.0, b = 0.0`) when support is thin or log-loss worsens, prevents calibration collapse and drops Brier score from `0.0041` to `0.0040`.
|
|
210
|
+
|
|
211
|
+
</details>
|
|
212
|
+
|
|
213
|
+
<details>
|
|
214
|
+
<summary>Example <code>failcast explain</code> Output (PyGithub/PyGithub)</summary>
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
$ failcast explain tests/PullRequest.py::PullRequest::testAttributes
|
|
218
|
+
Test: tests/PullRequest.py::PullRequest::testAttributes
|
|
219
|
+
File: tests/PullRequest.py
|
|
220
|
+
Model Mode: gbdt
|
|
221
|
+
Fail Prob: 0.0000
|
|
222
|
+
Raw Margin: -11.634332
|
|
223
|
+
Est Duration: 50 ms
|
|
224
|
+
Yield Score: 0.000000 prob/ms
|
|
225
|
+
Diff Files: 1
|
|
226
|
+
|
|
227
|
+
Top Contributing Signals:
|
|
228
|
+
- path_jaccard_max = 0.5000 (path token overlap (Jaccard=0.50) with modified file(s))
|
|
229
|
+
- cochange_freq_max = 0.4000 (frequently co-changed in git history (40% of modified file commits))
|
|
230
|
+
- ast_min_hop = 4.0 (test imports modified code within 4 AST hop(s))
|
|
231
|
+
- touched_file_churn_30d = 1.0 (modified file(s) had 1 commit(s) in the last 30 days)
|
|
232
|
+
|
|
233
|
+
16-Feature Breakdown:
|
|
234
|
+
# Feature Value
|
|
235
|
+
-- -------------------------- ------------
|
|
236
|
+
0 ast_min_hop 4.0
|
|
237
|
+
1 direct_test_modified 0.0
|
|
238
|
+
2 path_jaccard_max 0.5000
|
|
239
|
+
3 same_dir_overlap 0.0
|
|
240
|
+
4 cofail_rate_max 0.0455
|
|
241
|
+
5 cochange_freq_max 0.4000
|
|
242
|
+
6 ewma_fail_10 0.0
|
|
243
|
+
7 ewma_fail_50 0.0
|
|
244
|
+
8 runs_since_last_fail NaN
|
|
245
|
+
9 total_test_runs 80.0
|
|
246
|
+
10 median_duration_ms 50.0
|
|
247
|
+
11 flakiness_rate 0.0
|
|
248
|
+
12 diff_files_count 1.0
|
|
249
|
+
13 diff_lines_total 1.0986
|
|
250
|
+
14 diff_top_dirs_count 1.0
|
|
251
|
+
15 touched_file_churn_30d 1.0
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
</details>
|
|
255
|
+
|
|
256
|
+
<details>
|
|
257
|
+
<summary>Reproducing Benchmarks</summary>
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Collect pre-merge PR pytest runs from any public GitHub repository
|
|
261
|
+
python3 scripts/collect_gha_pytest.py \
|
|
262
|
+
--repo PyGithub/PyGithub --workflow CI \
|
|
263
|
+
--max-runs 100 --min-failures 25 \
|
|
264
|
+
--out ./bench-data/pr_runs.jsonl
|
|
265
|
+
|
|
266
|
+
# Initialize, import, evaluate, and plot against a local checkout of the target repo
|
|
267
|
+
git clone https://github.com/PyGithub/PyGithub ../PyGithub
|
|
268
|
+
(cd ../PyGithub \
|
|
269
|
+
&& failcast init --history-limit 1000 \
|
|
270
|
+
&& failcast import-runs ../failcast/bench-data/pr_runs.jsonl \
|
|
271
|
+
&& failcast eval --budgets 0.05,0.1,0.15,0.2,0.3,0.5 --output-json ../failcast/docs/benchmarks/eval_report.json)
|
|
272
|
+
|
|
273
|
+
python3 scripts/plot_benchmarks.py --input docs/benchmarks/eval_report.json --out-dir docs/benchmarks --repo-label "PyGithub/PyGithub"
|
|
274
|
+
|
|
275
|
+
# Measure release binary footprint, CLI latency, and pure failcast-ml inference throughput
|
|
276
|
+
python3 scripts/bench_systems.py --repo-dir ../PyGithub --runs 15 --out-json docs/benchmarks/systems_bench.json
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
</details>
|
|
280
|
+
|
|
281
|
+
## MCP Server (`failcast mcp`)
|
|
282
|
+
|
|
283
|
+
`failcast mcp` serves a local [Model Context Protocol](https://modelcontextprotocol.io) endpoint over `stdio` using `rmcp`. JSON-RPC 2.0 frames own `stdout`, while tracing logs and subprocess diagnostics route to `stderr` or captured pipes.
|
|
284
|
+
|
|
285
|
+
| Tool | Description |
|
|
286
|
+
| :--- | :--- |
|
|
287
|
+
| `select_tests` | Dry-run test selection for the current working-tree diff (`budget_seconds`, `top_k`, `target_recall`, `refresh_tests`). |
|
|
288
|
+
| `run_fast_tests` | Select and execute tests within a budget or top-k limit, persist outcomes to `.failcast/store.db`, and return structured pass/fail counts with bounded tracebacks (`budget_seconds`, `top_k`, `run_all`, `refresh_tests`). |
|
|
289
|
+
| `explain_selection` | Return all 16 features, active model mode, calibrated failure probability, yield score, and top contributing signals for a specific `test_id` (`test_id`, `refresh_tests`). |
|
|
290
|
+
|
|
291
|
+
Point your MCP client (Claude Desktop, Cursor, Claude Code, Antigravity) at `failcast mcp` with `cwd` set to the Python repo you are working in:
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"mcpServers": {
|
|
296
|
+
"failcast": {
|
|
297
|
+
"command": "failcast",
|
|
298
|
+
"args": ["mcp"],
|
|
299
|
+
"cwd": "/path/to/your/python-repo"
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Architecture
|
|
306
|
+
|
|
307
|
+
| Crate | Responsibility |
|
|
308
|
+
| :--- | :--- |
|
|
309
|
+
| `failcast-core` | Pure domain types (`TestCase`, `DiffSummary`, `HistorySnapshot`, `Config`, `TestRunner`, `FailcastError`). Zero I/O or subprocesses. |
|
|
310
|
+
| `failcast-store` | Bundled SQLite store in WAL mode, schema migrations, atomic run/batch writes, and point-in-time (`< as_of_ts`) history queries. |
|
|
311
|
+
| `failcast-collectors` | Working-tree `git diff` and `git log` mining, isolated `TempGitWorktree` for commit backfills, and a Tree-sitter Python file-level import graph. |
|
|
312
|
+
| `failcast-ml` | 16-feature extractor, cold-start heuristic ranker, `forust-ml` GBDT trainer, Newton-Raphson Platt calibrator, and deterministic cost-aware selector. |
|
|
313
|
+
| `failcast-runners` | `TestRunner` implementation for `pytest` with JUnit XML parsing and bounded failure tracebacks. |
|
|
314
|
+
| `failcast-eval` | Chronological walk-forward evaluator comparing Failcast against `Random`, `StaticAst`, and `RecentFailureRate` baselines. |
|
|
315
|
+
| `failcast` (`crates/failcast-cli`) | The `failcast` binary: shared `service.rs`, Clap subcommands, JSONL CI importer, and `rmcp` stdio MCP server. |
|
|
316
|
+
|
|
317
|
+
<details>
|
|
318
|
+
<summary>Dependency graph</summary>
|
|
319
|
+
|
|
320
|
+
```text
|
|
321
|
+
+-------------------------------------------+
|
|
322
|
+
| failcast (crates/failcast-cli) |
|
|
323
|
+
| Clap CLI | service.rs | rmcp MCP |
|
|
324
|
+
+---------------+------+-------+------------+
|
|
325
|
+
|
|
|
326
|
+
+--------------------------------+--------------------------------+
|
|
327
|
+
| | |
|
|
328
|
+
v v v
|
|
329
|
+
+--------------------+ +-----------------------+ +---------------------+
|
|
330
|
+
| failcast-collectors| | failcast-ml | | failcast-runners |
|
|
331
|
+
| - git diff/history | | - 16 pure features | | - PytestRunner |
|
|
332
|
+
| - tree-sitter Py | | - Cold-start ranker | | - JUnit XML parser |
|
|
333
|
+
| AST import graph | | - forust-ml GBDT | | - Bounded tracebacks|
|
|
334
|
+
| - TempGitWorktree | | - Platt calibration | +---------------------+
|
|
335
|
+
+---------+----------+ | - Cost-aware selector | |
|
|
336
|
+
| +-----------+-----------+ |
|
|
337
|
+
+----------------------+ | +----------------------+
|
|
338
|
+
v v v
|
|
339
|
+
+--------------------+ +--------------------+
|
|
340
|
+
| failcast-store | | failcast-eval |
|
|
341
|
+
| - Bundled SQLite | | - Walk-forward |
|
|
342
|
+
| - WAL + migrations | | - Random/AST/EWMA |
|
|
343
|
+
| - As-of snapshots | | baselines |
|
|
344
|
+
+----------+---------+ +----------+---------+
|
|
345
|
+
| |
|
|
346
|
+
+-----------+------------+
|
|
347
|
+
v
|
|
348
|
+
+-------------------------+
|
|
349
|
+
| failcast-core |
|
|
350
|
+
| Pure types, Config, |
|
|
351
|
+
| TestRunner trait, Error |
|
|
352
|
+
+-------------------------+
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
</details>
|
|
356
|
+
|
|
357
|
+
## Development
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
cargo fmt --all -- --check
|
|
361
|
+
cargo clippy --workspace --all-targets -- -D warnings
|
|
362
|
+
cargo test --workspace
|
|
363
|
+
python3 -m unittest scripts/test_collect_gha_pytest.py
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## License
|
|
367
|
+
|
|
368
|
+
MIT. See [LICENSE](LICENSE).
|
|
369
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
failcast-0.1.0.data/scripts/failcast.exe,sha256=VRgjb9N30JnqakTL5BMgHf9cICx2_vwgxxQBtSCfNZI,10070016
|
|
2
|
+
failcast-0.1.0.dist-info/METADATA,sha256=bURKc14HBaXoGetpVs1Nlf6xt2QxgP-dnqpPEErY2HQ,22647
|
|
3
|
+
failcast-0.1.0.dist-info/WHEEL,sha256=Uvw7WSmy7Kj2FBk8Va4L_dq4MDW8X5Ynby-pOX3ZNS0,94
|
|
4
|
+
failcast-0.1.0.dist-info/licenses/LICENSE,sha256=wKaX_MZ18D1x_M5DC5vpEmKuj70i4dBgsLiRx254rFg,1084
|
|
5
|
+
failcast-0.1.0.dist-info/sboms/failcast.cyclonedx.json,sha256=Bkxin08cN6DZChRm44QpqAyKT0vMOed1TSt0Rm-hJ_I,195677
|
|
6
|
+
failcast-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AL3XPI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|