forge-shield 1.2.2__tar.gz
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.
- forge_shield-1.2.2/LICENSE +21 -0
- forge_shield-1.2.2/PKG-INFO +176 -0
- forge_shield-1.2.2/README.md +135 -0
- forge_shield-1.2.2/forge.py +4907 -0
- forge_shield-1.2.2/forge_shield.egg-info/PKG-INFO +176 -0
- forge_shield-1.2.2/forge_shield.egg-info/SOURCES.txt +14 -0
- forge_shield-1.2.2/forge_shield.egg-info/dependency_links.txt +1 -0
- forge_shield-1.2.2/forge_shield.egg-info/entry_points.txt +2 -0
- forge_shield-1.2.2/forge_shield.egg-info/requires.txt +20 -0
- forge_shield-1.2.2/forge_shield.egg-info/top_level.txt +1 -0
- forge_shield-1.2.2/pyproject.toml +91 -0
- forge_shield-1.2.2/setup.cfg +4 -0
- forge_shield-1.2.2/tests/test_cli_entry_point.py +282 -0
- forge_shield-1.2.2/tests/test_forge_destructive_skip.py +290 -0
- forge_shield-1.2.2/tests/test_forge_real_algos.py +4078 -0
- forge_shield-1.2.2/tests/test_typing.py +53 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sky1241
|
|
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.
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: forge-shield
|
|
3
|
+
Version: 1.2.2
|
|
4
|
+
Summary: Pytest regression shield with predictive analytics — Louvain communities, Kaplan-Meier survival, adaptive Kalman over git history
|
|
5
|
+
Author: sky1241
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sky1241/forge
|
|
8
|
+
Project-URL: Issues, https://github.com/sky1241/forge/issues
|
|
9
|
+
Project-URL: Repository, https://github.com/sky1241/forge
|
|
10
|
+
Project-URL: Changelog, https://github.com/sky1241/forge/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: pytest,regression,testing,louvain,kaplan-meier,kalman,defect-prediction,flaky-tests
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Testing
|
|
21
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Provides-Extra: mutate
|
|
26
|
+
Requires-Dist: libcst>=1.0; extra == "mutate"
|
|
27
|
+
Provides-Extra: locate
|
|
28
|
+
Requires-Dist: coverage>=7.0; extra == "locate"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0; extra == "locate"
|
|
30
|
+
Provides-Extra: fuzz
|
|
31
|
+
Requires-Dist: hypothesis>=6.0; extra == "fuzz"
|
|
32
|
+
Provides-Extra: all
|
|
33
|
+
Requires-Dist: forge-shield[fuzz,locate,mutate]; extra == "all"
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-timeout>=2.0; extra == "dev"
|
|
37
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
38
|
+
Requires-Dist: mutmut>=2.4; extra == "dev"
|
|
39
|
+
Requires-Dist: forge-shield[fuzz,locate,mutate]; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# forge
|
|
43
|
+
|
|
44
|
+
[](https://github.com/sky1241/forge/actions/workflows/test.yml)
|
|
45
|
+
[](https://github.com/sky1241/forge)
|
|
46
|
+
[](https://www.python.org/downloads/)
|
|
47
|
+
[](LICENSE)
|
|
48
|
+
|
|
49
|
+
Pytest regression shield with predictive analytics for Python repos. Single-file core, stdlib-only runtime (pytest is the only required dep — bring your own).
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install forge-shield
|
|
53
|
+
forge --init # scaffold .forge/ and BUGS.md
|
|
54
|
+
forge --baseline # snapshot current test suite
|
|
55
|
+
forge # detect regressions vs baseline
|
|
56
|
+
forge --carmack # rank files by predicted defect risk
|
|
57
|
+
forge --shield # orchestrate: predict → gen tests → run impacted
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## How it compares to industry tools (cycle 8 bench, see [BENCHMARK.md](BENCHMARK.md))
|
|
61
|
+
|
|
62
|
+
| Job | forge | Industry tool | Result |
|
|
63
|
+
|---|---|---|---|
|
|
64
|
+
| Mutation testing — `httpie/cli/argparser.py` | `--mutate` (libcst, 70 mutants) | `mutmut` (regex, 301 mutants) | **forge 100% kill in 11min** vs mutmut 33% in 16min |
|
|
65
|
+
| Test impact selection on import-graph change | `--fast-deep` (Bazel-style transitive) | `pytest --testmon` (coverage-based) | testmon wins warm; **fast-deep wins cold-start CI** (no `.testmondata` to maintain) |
|
|
66
|
+
| Architecture quality metric | `--modularity` (Newman-Girvan Q) | `pydeps` (graph extraction) | **forge unique** — pydeps has no Q metric |
|
|
67
|
+
|
|
68
|
+
See [BENCHMARK.md](BENCHMARK.md) for the 6 frictions admitted (test set asymmetry, mutmut crash, black skipped per timeout cap).
|
|
69
|
+
|
|
70
|
+
## What's new (cycle 4)
|
|
71
|
+
|
|
72
|
+
- **`mypy --strict`** passes the entire codebase (`tests/test_typing.py` enforces).
|
|
73
|
+
- **`--mutate`** now uses [libcst](https://github.com/Instagram/LibCST) (AST-aware) — 0 invalid mutants by construction. The previous regex backend produced 23.4% syntax-error noise on real repos (filelock, attrs, mistune); see [`docs/D3B_RUNTIME_VALIDATION.md`](docs/D3B_RUNTIME_VALIDATION.md).
|
|
74
|
+
- **Granular install extras**: `[mutate]` / `[locate]` / `[fuzz]` / `[all]` — pay only for the subcommands you use.
|
|
75
|
+
- **`.forge/config.json`** consumes 21 user-tunable knobs (mutation threshold, ochiai top-N, kalman Q/R, KM horizon, hamming severity, ochiai cutoffs, carmack composite weights, full-cycle small-file LOC, all subprocess timeouts).
|
|
76
|
+
- **CLI validator** rejects unknown flags with a `did you mean` hint via `difflib`.
|
|
77
|
+
|
|
78
|
+
See [CHANGELOG.md](CHANGELOG.md) for the full picture.
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
### Default (zero deps beyond stdlib + your pytest)
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install forge-shield
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Ships with: `--predict`, `--carmack`, `--baseline`, `--diff`, `--watch`, `--bisect`, `--flaky`, `--snapshot`, `--add`, `--close`, `--fast`, `--heatmap`, `--init`.
|
|
89
|
+
|
|
90
|
+
### With optional features
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install 'forge-shield[mutate]' # adds --mutate (libcst-based)
|
|
94
|
+
pip install 'forge-shield[locate]' # adds --locate (Ochiai SBFL via coverage)
|
|
95
|
+
pip install 'forge-shield[fuzz]' # adds --gen-props (Hypothesis)
|
|
96
|
+
pip install 'forge-shield[all]' # everything above
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## What it does
|
|
100
|
+
|
|
101
|
+
- **Baseline & regression detection** — snapshots your pytest results, flags any test that goes from pass to fail.
|
|
102
|
+
- **Flaky test detection** — re-runs failures, classifies flaky vs deterministic.
|
|
103
|
+
- **Defect-prone file ranking** (`--carmack`) — combines git churn, import coupling and test-failure history into a per-file risk score.
|
|
104
|
+
- **Test generation** (`--gen-props`) — emits Hypothesis property tests for pure functions, with a destructive-side-effect AST guard so it never runs `gen_props` on code that writes files or shells out.
|
|
105
|
+
- **Mutation testing** (`--mutate`) — libcst (AST-aware) mutator, Offutt 1996 operators (AOR, ROR, LCR, UOI, SDL).
|
|
106
|
+
- **Fault localization** (`--locate`) — Ochiai SBFL formula over `coverage.py` data.
|
|
107
|
+
- **Delta debugging** (`--minimize`) — ddmin (Zeller 2002) to shrink failing inputs.
|
|
108
|
+
|
|
109
|
+
### All subcommands
|
|
110
|
+
|
|
111
|
+
| Sub-command | What it does |
|
|
112
|
+
|---|---|
|
|
113
|
+
| `forge` | Run tests vs baseline |
|
|
114
|
+
| `forge --baseline` | Snapshot the suite |
|
|
115
|
+
| `forge --predict` | Rank files by churn-based defect risk |
|
|
116
|
+
| `forge --carmack` | Multi-signal risk score |
|
|
117
|
+
| `forge --modularity` | Newman-Girvan Q over the import graph |
|
|
118
|
+
| `forge --mutate` | Mutation testing (whole repo) |
|
|
119
|
+
| `forge --mutate --paths-to-mutate FILE` | Mutation testing scoped to one validated file |
|
|
120
|
+
| `forge --locate` | Ochiai SBFL fault localization |
|
|
121
|
+
| `forge --gen-props` | Hypothesis property tests |
|
|
122
|
+
| `forge --bisect TEST` | Bisect a failing test back to its commit |
|
|
123
|
+
| `forge --flaky [N]` | Run tests N times to find flaky |
|
|
124
|
+
| `forge --snapshot CMD` | Capture command output as golden |
|
|
125
|
+
| `forge --snapshot-check` | Diff against goldens |
|
|
126
|
+
| `forge --add "DESC"` | Log a bug in BUGS.md |
|
|
127
|
+
| `forge --close BUG-ID` | Mark a bug fixed |
|
|
128
|
+
| `forge --watch` | Auto re-run on file change |
|
|
129
|
+
| `forge --fast` | Run only directly-impacted tests (1-hop) |
|
|
130
|
+
| `forge --fast-deep` | Transitive impact via inverted import graph (Bazel-style) |
|
|
131
|
+
| `forge --full-cycle` | Run the full pipeline |
|
|
132
|
+
|
|
133
|
+
`forge --help` for the complete flag list and examples; `forge --version` to print the installed version.
|
|
134
|
+
|
|
135
|
+
## Optional features
|
|
136
|
+
|
|
137
|
+
| Feature | Extra | Backend |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| `--mutate` (Offutt 1996 mutation testing) | `[mutate]` | [libcst](https://github.com/Instagram/LibCST) AST-aware |
|
|
140
|
+
| `--locate` (Abreu 2007 Ochiai SBFL) | `[locate]` | [coverage.py](https://coverage.readthedocs.io/) + pytest-cov |
|
|
141
|
+
| `--gen-props` (Hypothesis property tests) | `[fuzz]` | [hypothesis](https://hypothesis.readthedocs.io/) |
|
|
142
|
+
|
|
143
|
+
Forge prints a clean install hint (no Python traceback) if you invoke a subcommand without its extra installed — e.g. `forge --mutate` without `[mutate]` says `pip install 'forge-shield[mutate]'` and exits.
|
|
144
|
+
|
|
145
|
+
## What's actually inside
|
|
146
|
+
|
|
147
|
+
Algorithms are implemented from the papers, not wrapped from sklearn/scipy/networkx.
|
|
148
|
+
|
|
149
|
+
| Algorithm | Implementation | Reference |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| Louvain community detection | greedy modularity gain, pure Python | Blondel et al. 2008 |
|
|
152
|
+
| Newman-Girvan modularity Q | `(1/2m)·Σ[A_ij − k_i·k_j/2m]·δ` | Newman & Girvan 2004 |
|
|
153
|
+
| Kaplan-Meier survival | right-censoring, ties handled events-first | Kaplan & Meier 1958 |
|
|
154
|
+
| Adaptive Kalman filter | innovation-based variance re-estimation | Mehra 1970 (style) |
|
|
155
|
+
| Haar wavelet | textbook avg/diff, padded to power of 2 | — |
|
|
156
|
+
| DTW | O(n·m) DP matrix | Sakoe & Chiba 1978 |
|
|
157
|
+
| Ochiai SBFL | `failed / sqrt(totalFailed × (passed+failed))` | Abreu et al. 2007 |
|
|
158
|
+
| ddmin | unresolved-aware delta debugging | Zeller & Hildebrandt 2002 |
|
|
159
|
+
|
|
160
|
+
Validation tests pin known results: Karate Club graph Q ∈ [0.38, 0.45] (Zachary 1977), Kaplan-Meier hand-checked survival probabilities, two-cliques+bridge community split.
|
|
161
|
+
|
|
162
|
+
## Honest limits
|
|
163
|
+
|
|
164
|
+
- The composite `carmack_score` weights (kalman 0.25, wavelet 0.20, crash 0.25, coupling 0.15, churn 0.15) are **heuristic, not calibrated against a labelled dataset**. Use it as a ranking signal, not a probability.
|
|
165
|
+
- The "adaptive Kalman" is innovation-based variance re-estimation, not full Shumway-Stoffer EM with RTS smoother.
|
|
166
|
+
- Coverage of forge's own CLI subcommands is partial — the math primitives are well tested, the orchestration code is not.
|
|
167
|
+
|
|
168
|
+
## Requirements
|
|
169
|
+
|
|
170
|
+
- Python ≥ 3.11 (uses stdlib `tomllib`)
|
|
171
|
+
- pytest (your project's test runner — not bundled with forge)
|
|
172
|
+
- Cross-platform: macOS / Linux / Windows. Subprocess calls go through `sys.executable -m pytest` with UTF-8 `errors=replace`.
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
MIT — see [LICENSE](LICENSE). Changelog: [CHANGELOG.md](CHANGELOG.md).
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# forge
|
|
2
|
+
|
|
3
|
+
[](https://github.com/sky1241/forge/actions/workflows/test.yml)
|
|
4
|
+
[](https://github.com/sky1241/forge)
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
Pytest regression shield with predictive analytics for Python repos. Single-file core, stdlib-only runtime (pytest is the only required dep — bring your own).
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install forge-shield
|
|
12
|
+
forge --init # scaffold .forge/ and BUGS.md
|
|
13
|
+
forge --baseline # snapshot current test suite
|
|
14
|
+
forge # detect regressions vs baseline
|
|
15
|
+
forge --carmack # rank files by predicted defect risk
|
|
16
|
+
forge --shield # orchestrate: predict → gen tests → run impacted
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## How it compares to industry tools (cycle 8 bench, see [BENCHMARK.md](BENCHMARK.md))
|
|
20
|
+
|
|
21
|
+
| Job | forge | Industry tool | Result |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| Mutation testing — `httpie/cli/argparser.py` | `--mutate` (libcst, 70 mutants) | `mutmut` (regex, 301 mutants) | **forge 100% kill in 11min** vs mutmut 33% in 16min |
|
|
24
|
+
| Test impact selection on import-graph change | `--fast-deep` (Bazel-style transitive) | `pytest --testmon` (coverage-based) | testmon wins warm; **fast-deep wins cold-start CI** (no `.testmondata` to maintain) |
|
|
25
|
+
| Architecture quality metric | `--modularity` (Newman-Girvan Q) | `pydeps` (graph extraction) | **forge unique** — pydeps has no Q metric |
|
|
26
|
+
|
|
27
|
+
See [BENCHMARK.md](BENCHMARK.md) for the 6 frictions admitted (test set asymmetry, mutmut crash, black skipped per timeout cap).
|
|
28
|
+
|
|
29
|
+
## What's new (cycle 4)
|
|
30
|
+
|
|
31
|
+
- **`mypy --strict`** passes the entire codebase (`tests/test_typing.py` enforces).
|
|
32
|
+
- **`--mutate`** now uses [libcst](https://github.com/Instagram/LibCST) (AST-aware) — 0 invalid mutants by construction. The previous regex backend produced 23.4% syntax-error noise on real repos (filelock, attrs, mistune); see [`docs/D3B_RUNTIME_VALIDATION.md`](docs/D3B_RUNTIME_VALIDATION.md).
|
|
33
|
+
- **Granular install extras**: `[mutate]` / `[locate]` / `[fuzz]` / `[all]` — pay only for the subcommands you use.
|
|
34
|
+
- **`.forge/config.json`** consumes 21 user-tunable knobs (mutation threshold, ochiai top-N, kalman Q/R, KM horizon, hamming severity, ochiai cutoffs, carmack composite weights, full-cycle small-file LOC, all subprocess timeouts).
|
|
35
|
+
- **CLI validator** rejects unknown flags with a `did you mean` hint via `difflib`.
|
|
36
|
+
|
|
37
|
+
See [CHANGELOG.md](CHANGELOG.md) for the full picture.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
### Default (zero deps beyond stdlib + your pytest)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install forge-shield
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Ships with: `--predict`, `--carmack`, `--baseline`, `--diff`, `--watch`, `--bisect`, `--flaky`, `--snapshot`, `--add`, `--close`, `--fast`, `--heatmap`, `--init`.
|
|
48
|
+
|
|
49
|
+
### With optional features
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install 'forge-shield[mutate]' # adds --mutate (libcst-based)
|
|
53
|
+
pip install 'forge-shield[locate]' # adds --locate (Ochiai SBFL via coverage)
|
|
54
|
+
pip install 'forge-shield[fuzz]' # adds --gen-props (Hypothesis)
|
|
55
|
+
pip install 'forge-shield[all]' # everything above
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## What it does
|
|
59
|
+
|
|
60
|
+
- **Baseline & regression detection** — snapshots your pytest results, flags any test that goes from pass to fail.
|
|
61
|
+
- **Flaky test detection** — re-runs failures, classifies flaky vs deterministic.
|
|
62
|
+
- **Defect-prone file ranking** (`--carmack`) — combines git churn, import coupling and test-failure history into a per-file risk score.
|
|
63
|
+
- **Test generation** (`--gen-props`) — emits Hypothesis property tests for pure functions, with a destructive-side-effect AST guard so it never runs `gen_props` on code that writes files or shells out.
|
|
64
|
+
- **Mutation testing** (`--mutate`) — libcst (AST-aware) mutator, Offutt 1996 operators (AOR, ROR, LCR, UOI, SDL).
|
|
65
|
+
- **Fault localization** (`--locate`) — Ochiai SBFL formula over `coverage.py` data.
|
|
66
|
+
- **Delta debugging** (`--minimize`) — ddmin (Zeller 2002) to shrink failing inputs.
|
|
67
|
+
|
|
68
|
+
### All subcommands
|
|
69
|
+
|
|
70
|
+
| Sub-command | What it does |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `forge` | Run tests vs baseline |
|
|
73
|
+
| `forge --baseline` | Snapshot the suite |
|
|
74
|
+
| `forge --predict` | Rank files by churn-based defect risk |
|
|
75
|
+
| `forge --carmack` | Multi-signal risk score |
|
|
76
|
+
| `forge --modularity` | Newman-Girvan Q over the import graph |
|
|
77
|
+
| `forge --mutate` | Mutation testing (whole repo) |
|
|
78
|
+
| `forge --mutate --paths-to-mutate FILE` | Mutation testing scoped to one validated file |
|
|
79
|
+
| `forge --locate` | Ochiai SBFL fault localization |
|
|
80
|
+
| `forge --gen-props` | Hypothesis property tests |
|
|
81
|
+
| `forge --bisect TEST` | Bisect a failing test back to its commit |
|
|
82
|
+
| `forge --flaky [N]` | Run tests N times to find flaky |
|
|
83
|
+
| `forge --snapshot CMD` | Capture command output as golden |
|
|
84
|
+
| `forge --snapshot-check` | Diff against goldens |
|
|
85
|
+
| `forge --add "DESC"` | Log a bug in BUGS.md |
|
|
86
|
+
| `forge --close BUG-ID` | Mark a bug fixed |
|
|
87
|
+
| `forge --watch` | Auto re-run on file change |
|
|
88
|
+
| `forge --fast` | Run only directly-impacted tests (1-hop) |
|
|
89
|
+
| `forge --fast-deep` | Transitive impact via inverted import graph (Bazel-style) |
|
|
90
|
+
| `forge --full-cycle` | Run the full pipeline |
|
|
91
|
+
|
|
92
|
+
`forge --help` for the complete flag list and examples; `forge --version` to print the installed version.
|
|
93
|
+
|
|
94
|
+
## Optional features
|
|
95
|
+
|
|
96
|
+
| Feature | Extra | Backend |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| `--mutate` (Offutt 1996 mutation testing) | `[mutate]` | [libcst](https://github.com/Instagram/LibCST) AST-aware |
|
|
99
|
+
| `--locate` (Abreu 2007 Ochiai SBFL) | `[locate]` | [coverage.py](https://coverage.readthedocs.io/) + pytest-cov |
|
|
100
|
+
| `--gen-props` (Hypothesis property tests) | `[fuzz]` | [hypothesis](https://hypothesis.readthedocs.io/) |
|
|
101
|
+
|
|
102
|
+
Forge prints a clean install hint (no Python traceback) if you invoke a subcommand without its extra installed — e.g. `forge --mutate` without `[mutate]` says `pip install 'forge-shield[mutate]'` and exits.
|
|
103
|
+
|
|
104
|
+
## What's actually inside
|
|
105
|
+
|
|
106
|
+
Algorithms are implemented from the papers, not wrapped from sklearn/scipy/networkx.
|
|
107
|
+
|
|
108
|
+
| Algorithm | Implementation | Reference |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| Louvain community detection | greedy modularity gain, pure Python | Blondel et al. 2008 |
|
|
111
|
+
| Newman-Girvan modularity Q | `(1/2m)·Σ[A_ij − k_i·k_j/2m]·δ` | Newman & Girvan 2004 |
|
|
112
|
+
| Kaplan-Meier survival | right-censoring, ties handled events-first | Kaplan & Meier 1958 |
|
|
113
|
+
| Adaptive Kalman filter | innovation-based variance re-estimation | Mehra 1970 (style) |
|
|
114
|
+
| Haar wavelet | textbook avg/diff, padded to power of 2 | — |
|
|
115
|
+
| DTW | O(n·m) DP matrix | Sakoe & Chiba 1978 |
|
|
116
|
+
| Ochiai SBFL | `failed / sqrt(totalFailed × (passed+failed))` | Abreu et al. 2007 |
|
|
117
|
+
| ddmin | unresolved-aware delta debugging | Zeller & Hildebrandt 2002 |
|
|
118
|
+
|
|
119
|
+
Validation tests pin known results: Karate Club graph Q ∈ [0.38, 0.45] (Zachary 1977), Kaplan-Meier hand-checked survival probabilities, two-cliques+bridge community split.
|
|
120
|
+
|
|
121
|
+
## Honest limits
|
|
122
|
+
|
|
123
|
+
- The composite `carmack_score` weights (kalman 0.25, wavelet 0.20, crash 0.25, coupling 0.15, churn 0.15) are **heuristic, not calibrated against a labelled dataset**. Use it as a ranking signal, not a probability.
|
|
124
|
+
- The "adaptive Kalman" is innovation-based variance re-estimation, not full Shumway-Stoffer EM with RTS smoother.
|
|
125
|
+
- Coverage of forge's own CLI subcommands is partial — the math primitives are well tested, the orchestration code is not.
|
|
126
|
+
|
|
127
|
+
## Requirements
|
|
128
|
+
|
|
129
|
+
- Python ≥ 3.11 (uses stdlib `tomllib`)
|
|
130
|
+
- pytest (your project's test runner — not bundled with forge)
|
|
131
|
+
- Cross-platform: macOS / Linux / Windows. Subprocess calls go through `sys.executable -m pytest` with UTF-8 `errors=replace`.
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT — see [LICENSE](LICENSE). Changelog: [CHANGELOG.md](CHANGELOG.md).
|