deployproof 0.2.2__tar.gz → 1.0.1__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.
- {deployproof-0.2.2/src/deployproof.egg-info → deployproof-1.0.1}/PKG-INFO +114 -13
- deployproof-1.0.1/README.md +375 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/pyproject.toml +2 -1
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/__init__.py +1 -1
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/cli.py +23 -11
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/control_flow.py +7 -2
- deployproof-1.0.1/src/deployproof/coverage_plugin.py +14 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/dependencies.py +73 -6
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/diff.py +87 -2
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/mocks.py +6 -4
- deployproof-1.0.1/src/deployproof/mutator.py +1854 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/reporter.py +7 -3
- {deployproof-0.2.2 → deployproof-1.0.1/src/deployproof.egg-info}/PKG-INFO +114 -13
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof.egg-info/SOURCES.txt +2 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof.egg-info/requires.txt +1 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_cli.py +68 -3
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_dependencies_extractor.py +39 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_diff.py +63 -0
- deployproof-1.0.1/tests/test_import_graph_discovery.py +62 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_mutator.py +326 -7
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_wsl.py +3 -1
- deployproof-0.2.2/README.md +0 -275
- deployproof-0.2.2/src/deployproof/mutator.py +0 -757
- {deployproof-0.2.2 → deployproof-1.0.1}/LICENSE +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/setup.cfg +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/secrets.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/symlinks.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof/wsl.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof.egg-info/dependency_links.txt +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof.egg-info/entry_points.txt +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/src/deployproof.egg-info/top_level.txt +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_baseline_collection_error.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_cli_dependency_scan.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_control_flow.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_dependencies_pypi.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_edge_cases_validation.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_mocks.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_mutation_suites.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_secrets.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_stress_regressions.py +0 -0
- {deployproof-0.2.2 → deployproof-1.0.1}/tests/test_symlinks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deployproof
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: A deterministic AI-code deployability checker that catches what coverage misses.
|
|
5
5
|
Author-email: SVS Praveen <svspraveens@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -26,16 +26,17 @@ Provides-Extra: dev
|
|
|
26
26
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
27
27
|
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
28
28
|
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: coverage>=7.0.0; extra == "dev"
|
|
29
30
|
Dynamic: license-file
|
|
30
31
|
|
|
31
32
|
# DeployProof
|
|
32
33
|
|
|
33
34
|
> Deterministic pre-push verification for AI-assisted codebases: AST mutation testing, credential scanning, sandbox-escape detection, mock-usage alerts, swallowed-exception checks, and dependency hallucination defense.
|
|
34
35
|
|
|
35
|
-
[](https://pypi.org/project/deployproof/)
|
|
36
37
|
[](https://pypi.org/project/deployproof/)
|
|
37
38
|
[](https://github.com/SVSPraveen/DeployProof/actions/workflows/ci.yml)
|
|
38
|
-
[](https://github.com/SVSPraveen/DeployProof)
|
|
39
40
|
[](stress_fixtures/)
|
|
40
41
|
[](LICENSE)
|
|
41
42
|
|
|
@@ -45,6 +46,8 @@ Dynamic: license-file
|
|
|
45
46
|
|
|
46
47
|
AI-assisted development introduces subtle failure modes that standard linters and coverage tools miss: test suites with high line coverage but near-zero mutation scores, hardcoded credentials generated in passing, symlinks that deceive approval prompts into escaping the repository sandbox, silently swallowed exceptions, and package names hallucinated by LLMs that don't exist on PyPI. DeployProof catches these at the pre-push stage, before they reach CI or production.
|
|
47
48
|
|
|
49
|
+
> **Privacy & Security Guarantee**: DeployProof runs 100% locally on your machine. It makes zero outbound network calls, except for querying the official PyPI registry (JSON API) to verify that newly introduced dependencies exist and are not hallucinated. DeployProof sends no source code, telemetry, test results, or secret findings to any external server.
|
|
50
|
+
|
|
48
51
|
## Install
|
|
49
52
|
|
|
50
53
|
```bash
|
|
@@ -53,19 +56,114 @@ pip install deployproof
|
|
|
53
56
|
|
|
54
57
|
Requires Python 3.10+.
|
|
55
58
|
|
|
56
|
-
##
|
|
59
|
+
## How to Use DeployProof
|
|
60
|
+
|
|
61
|
+
DeployProof provides two distinct modes of operation. We believe in total transparency about execution costs:
|
|
57
62
|
|
|
58
|
-
|
|
63
|
+
### 1. Diff-Scoped Pre-Push Gate (`deployproof check`) — *Primary Fast Workflow*
|
|
64
|
+
Evaluates **only the files modified in your active session or git diff** (1–3 files typically). Because only newly edited AST nodes are mutated, it executes in **2 to 5 seconds** in local developer loops, pre-commit hooks, and pre-push gates.
|
|
59
65
|
|
|
60
66
|
```bash
|
|
61
|
-
|
|
67
|
+
# Fast daily check: verifies modified files in your current working tree / git diff (2-5s)
|
|
68
|
+
deployproof check
|
|
69
|
+
|
|
70
|
+
# Output structured JSON for automation or IDE tooling
|
|
71
|
+
deployproof check --json
|
|
72
|
+
|
|
73
|
+
# Enforce strict gates on newly introduced mocks or swallowed errors
|
|
74
|
+
deployproof check --strict-mocks --strict-error-handling
|
|
62
75
|
```
|
|
63
76
|
|
|
64
|
-
|
|
77
|
+
### 2. Full Repository Audit Mode (`deployproof check --full-repo`) — *Thorough Codebase Audits*
|
|
78
|
+
Evaluates **every tracked Python file across the entire repository**. Because mutation testing generates hundreds or thousands of mutants and runs the test suite against each one in isolated multi-worker sandboxes, full repository scans take real, honest compute time:
|
|
65
79
|
|
|
66
80
|
```bash
|
|
67
|
-
|
|
81
|
+
# Run a full-repository audit across all tracked files
|
|
82
|
+
deployproof check --full-repo
|
|
83
|
+
|
|
84
|
+
# Customize the parallel worker process count (defaults to auto-detected CPU count capped at 8)
|
|
85
|
+
deployproof check --full-repo --workers 8
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Real-World Timing Expectations:
|
|
89
|
+
| Scan Mode | Target Scope | Typical Duration | Intended Use Case |
|
|
90
|
+
| :--- | :--- | :--- | :--- |
|
|
91
|
+
| **`deployproof check`** | Git Diff (1–3 modified files) | **2 – 5 seconds** | Local pre-commit, active AI IDE coding loops, pre-push sanity checks. |
|
|
92
|
+
| **`deployproof check --workers 8`** | Large Multi-File Diff (100+ mutants) | **1 – 3 minutes** | Large feature branch reviews, refactors. |
|
|
93
|
+
| **`deployproof check --full-repo`** | Small Repo (< 100 mutants, sequential) | **30s – 2 minutes** | Single-core / lightweight auditing. |
|
|
94
|
+
| **`deployproof check --full-repo --workers 8`** | Small Repo (< 100 mutants, 8 workers) | **15 – 30 seconds** | Rapid full baseline verification. |
|
|
95
|
+
| **`deployproof check --full-repo`** | Medium Repo (200–500 mutants, sequential) | **15 – 35 minutes** | Unconstrained single-thread verification. |
|
|
96
|
+
| **`deployproof check --full-repo --workers 8`** | Medium Repo (200–500 mutants, 8 workers) | **3 – 7 minutes** | Release validation, pre-tag quality gates. |
|
|
97
|
+
| **`deployproof check --full-repo`** | Heavy / Network Lib (`requests`, 800 mutants) | **60 – 85 minutes** | Deep overnight / weekly sweep. |
|
|
98
|
+
| **`deployproof check --full-repo --workers 8`** | Heavy / Network Lib (`requests`, 800 mutants) | **12 – 18 minutes** | High-throughput multi-core CI release builds. |
|
|
99
|
+
|
|
100
|
+
### Parallel Multi-Worker Sandboxing (`--workers N`)
|
|
101
|
+
|
|
102
|
+
DeployProof includes a built-in multi-process execution engine (`ProcessPoolExecutor`) for parallel mutation testing. You can supply `--workers <N>` to both diff-scoped checks and full-repo audits:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Parallelize a large uncommitted diff across 8 worker processes
|
|
106
|
+
deployproof check --workers 8
|
|
107
|
+
|
|
108
|
+
# Full repository audit distributed across 8 worker processes
|
|
109
|
+
deployproof check --full-repo --workers 8
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### How Parallel Sandboxing Works:
|
|
113
|
+
1. **Snapshot Creation**: DeployProof takes an initial atomic snapshot of your project into a clean temporary directory.
|
|
114
|
+
2. **PID-Keyed Sandboxes**: Each worker process receives its own dedicated filesystem sandbox (`worker_<PID>`), with an independent `pytest` cache (`--override-ini=cache_dir=...`) and separate temporary directory (`--basetemp=...`).
|
|
115
|
+
3. **Zero Mutation Leaks**: Mutants are generated and executed inside individual worker sandboxes in parallel. The working tree is untouched, and signal handlers (`SIGINT`, `SIGTERM`, `SIGBREAK`) ensure sandboxes are cleanly purged upon completion or interruption.
|
|
116
|
+
|
|
117
|
+
#### Advantages & When to Use:
|
|
118
|
+
* **Large Diff / Full Repo Speedup**: Near-linear execution scaling across CPU cores for batches with 50+ mutants, cutting 30-minute sweeps down to 5–8 minutes.
|
|
119
|
+
* **Process & Cache Isolation**: Eliminates cross-test state leakage, shared database locking, and `.pytest_cache` collisions between concurrent workers.
|
|
120
|
+
|
|
121
|
+
#### Trade-offs & When NOT to Use:
|
|
122
|
+
* **Small Daily Diffs (1–3 files)**: Do NOT use `--workers` for small 2-line edits. Spawning isolated sandboxes and copying file trees incurs ~1–2 seconds of snapshot overhead. Sequential in-place mutation executes in **2–5 seconds** with zero snapshot overhead.
|
|
123
|
+
* **Disk Space & I/O Overhead**: Running $N$ workers copies the repository snapshot $N$ times into temporary storage ($N \times \text{repo size}$ in `tempfile.gettempdir()`). On disk-constrained environments, use fewer workers (e.g. `--workers 2` or `--workers 4`).
|
|
124
|
+
* **Subprocess / Port Collisions**: If your test suite binds to fixed network ports (e.g. localhost:8080) without dynamic port selection, parallel workers running tests concurrently may trigger port conflicts. Use isolated ports or run sequentially in such environments.
|
|
125
|
+
|
|
126
|
+
#### Hardware & Memory Sizing Architecture (RAM & CPU Optimization):
|
|
127
|
+
|
|
128
|
+
DeployProof's parallel sandboxing engine scales throughput directly with **available physical RAM** and **logical CPU cores**. Because test execution is CPU-bound and sandbox file I/O is memory-bound, hardware capacity dictates performance:
|
|
129
|
+
|
|
68
130
|
```
|
|
131
|
+
Total Memory Required ≈ Base OS Overhead (~2 GB) + [ N_workers × (Worker Process RSS + OS Page Cache Footprint) ]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
##### 1. Why More RAM Directly Maximizes Verification Speed:
|
|
135
|
+
* **Zero-Latency In-Memory OS Page Cache**: When physical RAM comfortably exceeds the aggregate working set of all $N$ workers, the operating system holds all sandbox file trees, compiled `.pyc` modules, and pytest test fixtures directly in the **RAM page cache**. File mutations and test imports achieve sub-millisecond execution with zero physical NVMe/SSD read/write contention.
|
|
136
|
+
* **Elimination of Page-Fault Swapping**: If total RAM is insufficient for the requested `--workers N`, the OS kernel is forced to page memory to disk (`pagefile.sys` on Windows or swap partitions on Linux). Page thrashing introduces severe disk queue latency that can degrade multi-process test throughput by 5× to 10×. Higher RAM guarantees that all workers remain 100% compute-active in physical memory.
|
|
137
|
+
|
|
138
|
+
##### 2. Per-Worker Memory Consumption Profile:
|
|
139
|
+
* **Python Runtime & AST Engine**: ~35 MB RSS per worker.
|
|
140
|
+
* **Pytest Test Suite & Dependencies**: ~50 MB to 150 MB RSS per worker (depending on framework imports like FastAPI, Django, SQLAlchemy, or Requests).
|
|
141
|
+
* **Sandbox Working Directory Snapshot**: ~15 MB to 50 MB in OS file cache per worker.
|
|
142
|
+
* **Total Allocation per Worker Process**: **~100 MB to 250 MB RAM per worker**.
|
|
143
|
+
|
|
144
|
+
##### 3. Hardware Sizing & Safe Allocation Matrix:
|
|
145
|
+
|
|
146
|
+
| Installed System RAM | Recommended Worker Flag | Memory Consumed by DeployProof | System Headroom Remaining | Intended Verification Profile |
|
|
147
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
148
|
+
| **2 GB – 4 GB** | `deployproof check` *(Sequential)* | ~120 MB total | High (~2.5 GB free) | Ultra-lightweight diff checks; single-core laptops. |
|
|
149
|
+
| **8 GB** | `--workers 4` | ~0.8 GB – 1.0 GB | Safe (~5.5 GB free) | Standard local feature branches and medium diffs. |
|
|
150
|
+
| **16 GB** | **`--workers 8` to `--workers 16`** | **~1.6 GB – 3.2 GB** | **Abundant (~12.8 GB free)** | **Full CPU core saturation; rapid multi-file diffs & full-repo sweeps.** |
|
|
151
|
+
| **32 GB+** | `--workers 16` to `--workers 32` | ~3.5 GB – 6.5 GB | Enterprise headroom | Heavy monorepos, multi-thousand mutant CI sweeps. |
|
|
152
|
+
|
|
153
|
+
##### 4. Diff Scoped vs Full Repo Memory Comparison:
|
|
154
|
+
|
|
155
|
+
| Metric | Git Diff (`deployproof check --workers 8`) | Full Repo (`deployproof check --full-repo --workers 8`) | Technical Rationale |
|
|
156
|
+
| :--- | :--- | :--- | :--- |
|
|
157
|
+
| **Concurrent OS Processes** | 8 worker processes | 8 worker processes | **Identical** — `ProcessPoolExecutor` only executes $N$ workers concurrently. |
|
|
158
|
+
| **Worker Process RSS** | ~80 MB – 120 MB per process | ~120 MB – 180 MB per process | **Slightly higher** — Full repo sweeps import broader test suites and transitive frameworks into Python's `sys.modules`. |
|
|
159
|
+
| **Sandbox Snapshot Cache** | ~15 MB per sandbox | ~30 MB – 60 MB per sandbox | **Higher** — Full repo snapshots clone all tracked repo files into temporary directories. |
|
|
160
|
+
| **Total Memory with 8 Workers** | **~1.0 GB – 1.4 GB** | **~1.6 GB – 2.2 GB** | Modest increase; easily accommodated by standard 8 GB/16 GB machines. |
|
|
161
|
+
| **Total Memory with 16 Workers** | **~1.8 GB – 2.5 GB** | **~3.0 GB – 3.8 GB** | Complete 16-core saturation while leaving 12+ GB RAM free on 16 GB systems. |
|
|
162
|
+
|
|
163
|
+
##### 5. Minimum vs Recommended System Requirements:
|
|
164
|
+
* **Absolute Minimum System RAM**: **2 GB** (for default sequential diff-scoped `deployproof check`).
|
|
165
|
+
* **Minimum System RAM for Multi-Worker Mode (`--workers 4`)**: **4 GB**.
|
|
166
|
+
* **Recommended System RAM for Max-Throughput Parallel Mode (`--workers 8` or `16`)**: **16 GB** (provides sufficient headroom to keep 8 to 16 Python subprocesses and their entire sandboxes resident in physical memory).
|
|
69
167
|
|
|
70
168
|
Output includes a section for each check — symlink scan, secrets scan, dependency scan, mock detection, control flow analysis, and mutation score — with a pass/fail line at the bottom.
|
|
71
169
|
|
|
@@ -173,6 +271,8 @@ Pre-check clean: 100% of tested basic mutations caught.
|
|
|
173
271
|
| `deployproof check --files <paths...>` | Explicitly evaluate specific files (bypasses git diff). |
|
|
174
272
|
| `deployproof check --threshold <float>` | Minimum mutation score percentage required to pass (default: `80.0`). |
|
|
175
273
|
| `deployproof check --base <ref>` | Base git ref (branch/commit/tag) to diff against. |
|
|
274
|
+
| `deployproof check --full-repo` | Audit all tracked files across the entire repository root (respecting `.gitignore`), using isolated parallel workers. |
|
|
275
|
+
| `deployproof check --workers <int>` | Set the number of isolated parallel worker processes for `--full-repo` scans (default: auto-detected CPU count capped at 8). |
|
|
176
276
|
| `deployproof check --wsl` | Delegate mutation testing to `mutmut` inside WSL (Windows only). |
|
|
177
277
|
|
|
178
278
|
> **Note:** `deployproof check --wsl` (Windows only) is newer and less battle-tested than the core checks — [file an issue](https://github.com/SVSPraveen/DeployProof/issues) if you hit something.
|
|
@@ -189,7 +289,7 @@ deployproof check --json
|
|
|
189
289
|
|
|
190
290
|
```json
|
|
191
291
|
{
|
|
192
|
-
"version": "0.
|
|
292
|
+
"version": "1.0.0",
|
|
193
293
|
"status": "passed",
|
|
194
294
|
"summary": {
|
|
195
295
|
"target_files_count": 1,
|
|
@@ -270,9 +370,9 @@ deployproof check --json
|
|
|
270
370
|
- **Control Flow and Error Handling** — AST-based detector for bare `except:` without re-raise, silently swallowed broad exceptions (`except Exception:` that only `pass` or log/print without re-raising or returning error indicators), and dead/unreachable code following unconditional `return`, `raise`, `break`, or `continue`, with an optional `--strict-error-handling` hard gate.
|
|
271
371
|
|
|
272
372
|
## What This Doesn't Do
|
|
273
|
-
|
|
373
|
+
|
|
274
374
|
- **Test-only diffs are not yet caught.** If a diff modifies or weakens assertions in a test file without changing the corresponding source file, DeployProof currently sees zero modified source lines and passes with 0 mutants evaluated. This is a known gap — see [INVESTIGATION_blastradius.md](INVESTIGATION_blastradius.md) for the reverse-mapping approach being evaluated to close it. Until this lands, DeployProof does not protect against test suites being weakened directly.
|
|
275
|
-
- **
|
|
375
|
+
- **Diff-scoping vs Full Audits:** Standard `deployproof check` is intentionally scoped strictly to files modified in the active git diff (for 2–5s speed). To audit every file in the entire repository, explicitly pass the `--full-repo` flag.
|
|
276
376
|
- **Python only.** Mutation testing and import extraction currently support Python files only. Other languages are not scanned.
|
|
277
377
|
- **No auto-fix.** DeployProof reports findings; it does not modify your code, rewrite imports, or suggest patches.
|
|
278
378
|
- **No IDE plugin yet.** There is no VS Code extension or JetBrains plugin. The CLI is the interface. IDE integration is on the roadmap.
|
|
@@ -289,8 +389,8 @@ Fixtures cover weak test suites, zero-test orphan modules, planted OpenAI/AWS cr
|
|
|
289
389
|
|
|
290
390
|
## Status & Roadmap
|
|
291
391
|
|
|
292
|
-
- **Current (
|
|
293
|
-
- **Next:**
|
|
392
|
+
- **Current (v1.0.0):** Diff-scoped AST mutation testing (with recursive discovery and `SIGINT`/`SIGTERM`/`SIGBREAK` signal-safe disk restoration), **Full Repository Audit Mode (`--full-repo`)** with isolated parallel multi-worker sandboxes and AST import-graph test discovery, baseline test-collection failure isolation with distinct exit code `2`, entropy-driven value-based secrets scanner, GhostApproval symlink sandbox-escape detector, PyPI dependency hallucination / slopsquatting scanner (with import-to-distribution translation, recursive `-r` requirements scanning, and dynamic import detection via `importlib` / `__import__`), mock-introduction detector (`--strict-mocks`), control-flow / swallowed-exception scanner (`--strict-error-handling`), 11/11 launch-day stress test suite, **111 unit tests**, live unbuffered progress streaming, and machine-readable `--json` output.
|
|
393
|
+
- **Next:** Reverse test-to-source dependency mapping (see `FUTURE_SCOPE.md`), SARIF 2.1.0 PR annotations, and multi-language mutation rule packs.
|
|
294
394
|
|
|
295
395
|
## Contributing
|
|
296
396
|
|
|
@@ -303,3 +403,4 @@ MIT. See [LICENSE](LICENSE).
|
|
|
303
403
|
---
|
|
304
404
|
|
|
305
405
|
*Created by [SVS Praveen](https://github.com/SVSPraveen) · [Portfolio](https://svspraveen.vercel.app/) · [LinkedIn](https://www.linkedin.com/in/svs-praveen-s/)*
|
|
406
|
+
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
# DeployProof
|
|
2
|
+
|
|
3
|
+
> Deterministic pre-push verification for AI-assisted codebases: AST mutation testing, credential scanning, sandbox-escape detection, mock-usage alerts, swallowed-exception checks, and dependency hallucination defense.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/deployproof/)
|
|
6
|
+
[](https://pypi.org/project/deployproof/)
|
|
7
|
+
[](https://github.com/SVSPraveen/DeployProof/actions/workflows/ci.yml)
|
|
8
|
+
[](https://github.com/SVSPraveen/DeployProof)
|
|
9
|
+
[](stress_fixtures/)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Why This Exists
|
|
15
|
+
|
|
16
|
+
AI-assisted development introduces subtle failure modes that standard linters and coverage tools miss: test suites with high line coverage but near-zero mutation scores, hardcoded credentials generated in passing, symlinks that deceive approval prompts into escaping the repository sandbox, silently swallowed exceptions, and package names hallucinated by LLMs that don't exist on PyPI. DeployProof catches these at the pre-push stage, before they reach CI or production.
|
|
17
|
+
|
|
18
|
+
> **Privacy & Security Guarantee**: DeployProof runs 100% locally on your machine. It makes zero outbound network calls, except for querying the official PyPI registry (JSON API) to verify that newly introduced dependencies exist and are not hallucinated. DeployProof sends no source code, telemetry, test results, or secret findings to any external server.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install deployproof
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Requires Python 3.10+.
|
|
27
|
+
|
|
28
|
+
## How to Use DeployProof
|
|
29
|
+
|
|
30
|
+
DeployProof provides two distinct modes of operation. We believe in total transparency about execution costs:
|
|
31
|
+
|
|
32
|
+
### 1. Diff-Scoped Pre-Push Gate (`deployproof check`) — *Primary Fast Workflow*
|
|
33
|
+
Evaluates **only the files modified in your active session or git diff** (1–3 files typically). Because only newly edited AST nodes are mutated, it executes in **2 to 5 seconds** in local developer loops, pre-commit hooks, and pre-push gates.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Fast daily check: verifies modified files in your current working tree / git diff (2-5s)
|
|
37
|
+
deployproof check
|
|
38
|
+
|
|
39
|
+
# Output structured JSON for automation or IDE tooling
|
|
40
|
+
deployproof check --json
|
|
41
|
+
|
|
42
|
+
# Enforce strict gates on newly introduced mocks or swallowed errors
|
|
43
|
+
deployproof check --strict-mocks --strict-error-handling
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Full Repository Audit Mode (`deployproof check --full-repo`) — *Thorough Codebase Audits*
|
|
47
|
+
Evaluates **every tracked Python file across the entire repository**. Because mutation testing generates hundreds or thousands of mutants and runs the test suite against each one in isolated multi-worker sandboxes, full repository scans take real, honest compute time:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Run a full-repository audit across all tracked files
|
|
51
|
+
deployproof check --full-repo
|
|
52
|
+
|
|
53
|
+
# Customize the parallel worker process count (defaults to auto-detected CPU count capped at 8)
|
|
54
|
+
deployproof check --full-repo --workers 8
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Real-World Timing Expectations:
|
|
58
|
+
| Scan Mode | Target Scope | Typical Duration | Intended Use Case |
|
|
59
|
+
| :--- | :--- | :--- | :--- |
|
|
60
|
+
| **`deployproof check`** | Git Diff (1–3 modified files) | **2 – 5 seconds** | Local pre-commit, active AI IDE coding loops, pre-push sanity checks. |
|
|
61
|
+
| **`deployproof check --workers 8`** | Large Multi-File Diff (100+ mutants) | **1 – 3 minutes** | Large feature branch reviews, refactors. |
|
|
62
|
+
| **`deployproof check --full-repo`** | Small Repo (< 100 mutants, sequential) | **30s – 2 minutes** | Single-core / lightweight auditing. |
|
|
63
|
+
| **`deployproof check --full-repo --workers 8`** | Small Repo (< 100 mutants, 8 workers) | **15 – 30 seconds** | Rapid full baseline verification. |
|
|
64
|
+
| **`deployproof check --full-repo`** | Medium Repo (200–500 mutants, sequential) | **15 – 35 minutes** | Unconstrained single-thread verification. |
|
|
65
|
+
| **`deployproof check --full-repo --workers 8`** | Medium Repo (200–500 mutants, 8 workers) | **3 – 7 minutes** | Release validation, pre-tag quality gates. |
|
|
66
|
+
| **`deployproof check --full-repo`** | Heavy / Network Lib (`requests`, 800 mutants) | **60 – 85 minutes** | Deep overnight / weekly sweep. |
|
|
67
|
+
| **`deployproof check --full-repo --workers 8`** | Heavy / Network Lib (`requests`, 800 mutants) | **12 – 18 minutes** | High-throughput multi-core CI release builds. |
|
|
68
|
+
|
|
69
|
+
### Parallel Multi-Worker Sandboxing (`--workers N`)
|
|
70
|
+
|
|
71
|
+
DeployProof includes a built-in multi-process execution engine (`ProcessPoolExecutor`) for parallel mutation testing. You can supply `--workers <N>` to both diff-scoped checks and full-repo audits:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Parallelize a large uncommitted diff across 8 worker processes
|
|
75
|
+
deployproof check --workers 8
|
|
76
|
+
|
|
77
|
+
# Full repository audit distributed across 8 worker processes
|
|
78
|
+
deployproof check --full-repo --workers 8
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### How Parallel Sandboxing Works:
|
|
82
|
+
1. **Snapshot Creation**: DeployProof takes an initial atomic snapshot of your project into a clean temporary directory.
|
|
83
|
+
2. **PID-Keyed Sandboxes**: Each worker process receives its own dedicated filesystem sandbox (`worker_<PID>`), with an independent `pytest` cache (`--override-ini=cache_dir=...`) and separate temporary directory (`--basetemp=...`).
|
|
84
|
+
3. **Zero Mutation Leaks**: Mutants are generated and executed inside individual worker sandboxes in parallel. The working tree is untouched, and signal handlers (`SIGINT`, `SIGTERM`, `SIGBREAK`) ensure sandboxes are cleanly purged upon completion or interruption.
|
|
85
|
+
|
|
86
|
+
#### Advantages & When to Use:
|
|
87
|
+
* **Large Diff / Full Repo Speedup**: Near-linear execution scaling across CPU cores for batches with 50+ mutants, cutting 30-minute sweeps down to 5–8 minutes.
|
|
88
|
+
* **Process & Cache Isolation**: Eliminates cross-test state leakage, shared database locking, and `.pytest_cache` collisions between concurrent workers.
|
|
89
|
+
|
|
90
|
+
#### Trade-offs & When NOT to Use:
|
|
91
|
+
* **Small Daily Diffs (1–3 files)**: Do NOT use `--workers` for small 2-line edits. Spawning isolated sandboxes and copying file trees incurs ~1–2 seconds of snapshot overhead. Sequential in-place mutation executes in **2–5 seconds** with zero snapshot overhead.
|
|
92
|
+
* **Disk Space & I/O Overhead**: Running $N$ workers copies the repository snapshot $N$ times into temporary storage ($N \times \text{repo size}$ in `tempfile.gettempdir()`). On disk-constrained environments, use fewer workers (e.g. `--workers 2` or `--workers 4`).
|
|
93
|
+
* **Subprocess / Port Collisions**: If your test suite binds to fixed network ports (e.g. localhost:8080) without dynamic port selection, parallel workers running tests concurrently may trigger port conflicts. Use isolated ports or run sequentially in such environments.
|
|
94
|
+
|
|
95
|
+
#### Hardware & Memory Sizing Architecture (RAM & CPU Optimization):
|
|
96
|
+
|
|
97
|
+
DeployProof's parallel sandboxing engine scales throughput directly with **available physical RAM** and **logical CPU cores**. Because test execution is CPU-bound and sandbox file I/O is memory-bound, hardware capacity dictates performance:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Total Memory Required ≈ Base OS Overhead (~2 GB) + [ N_workers × (Worker Process RSS + OS Page Cache Footprint) ]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
##### 1. Why More RAM Directly Maximizes Verification Speed:
|
|
104
|
+
* **Zero-Latency In-Memory OS Page Cache**: When physical RAM comfortably exceeds the aggregate working set of all $N$ workers, the operating system holds all sandbox file trees, compiled `.pyc` modules, and pytest test fixtures directly in the **RAM page cache**. File mutations and test imports achieve sub-millisecond execution with zero physical NVMe/SSD read/write contention.
|
|
105
|
+
* **Elimination of Page-Fault Swapping**: If total RAM is insufficient for the requested `--workers N`, the OS kernel is forced to page memory to disk (`pagefile.sys` on Windows or swap partitions on Linux). Page thrashing introduces severe disk queue latency that can degrade multi-process test throughput by 5× to 10×. Higher RAM guarantees that all workers remain 100% compute-active in physical memory.
|
|
106
|
+
|
|
107
|
+
##### 2. Per-Worker Memory Consumption Profile:
|
|
108
|
+
* **Python Runtime & AST Engine**: ~35 MB RSS per worker.
|
|
109
|
+
* **Pytest Test Suite & Dependencies**: ~50 MB to 150 MB RSS per worker (depending on framework imports like FastAPI, Django, SQLAlchemy, or Requests).
|
|
110
|
+
* **Sandbox Working Directory Snapshot**: ~15 MB to 50 MB in OS file cache per worker.
|
|
111
|
+
* **Total Allocation per Worker Process**: **~100 MB to 250 MB RAM per worker**.
|
|
112
|
+
|
|
113
|
+
##### 3. Hardware Sizing & Safe Allocation Matrix:
|
|
114
|
+
|
|
115
|
+
| Installed System RAM | Recommended Worker Flag | Memory Consumed by DeployProof | System Headroom Remaining | Intended Verification Profile |
|
|
116
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
117
|
+
| **2 GB – 4 GB** | `deployproof check` *(Sequential)* | ~120 MB total | High (~2.5 GB free) | Ultra-lightweight diff checks; single-core laptops. |
|
|
118
|
+
| **8 GB** | `--workers 4` | ~0.8 GB – 1.0 GB | Safe (~5.5 GB free) | Standard local feature branches and medium diffs. |
|
|
119
|
+
| **16 GB** | **`--workers 8` to `--workers 16`** | **~1.6 GB – 3.2 GB** | **Abundant (~12.8 GB free)** | **Full CPU core saturation; rapid multi-file diffs & full-repo sweeps.** |
|
|
120
|
+
| **32 GB+** | `--workers 16` to `--workers 32` | ~3.5 GB – 6.5 GB | Enterprise headroom | Heavy monorepos, multi-thousand mutant CI sweeps. |
|
|
121
|
+
|
|
122
|
+
##### 4. Diff Scoped vs Full Repo Memory Comparison:
|
|
123
|
+
|
|
124
|
+
| Metric | Git Diff (`deployproof check --workers 8`) | Full Repo (`deployproof check --full-repo --workers 8`) | Technical Rationale |
|
|
125
|
+
| :--- | :--- | :--- | :--- |
|
|
126
|
+
| **Concurrent OS Processes** | 8 worker processes | 8 worker processes | **Identical** — `ProcessPoolExecutor` only executes $N$ workers concurrently. |
|
|
127
|
+
| **Worker Process RSS** | ~80 MB – 120 MB per process | ~120 MB – 180 MB per process | **Slightly higher** — Full repo sweeps import broader test suites and transitive frameworks into Python's `sys.modules`. |
|
|
128
|
+
| **Sandbox Snapshot Cache** | ~15 MB per sandbox | ~30 MB – 60 MB per sandbox | **Higher** — Full repo snapshots clone all tracked repo files into temporary directories. |
|
|
129
|
+
| **Total Memory with 8 Workers** | **~1.0 GB – 1.4 GB** | **~1.6 GB – 2.2 GB** | Modest increase; easily accommodated by standard 8 GB/16 GB machines. |
|
|
130
|
+
| **Total Memory with 16 Workers** | **~1.8 GB – 2.5 GB** | **~3.0 GB – 3.8 GB** | Complete 16-core saturation while leaving 12+ GB RAM free on 16 GB systems. |
|
|
131
|
+
|
|
132
|
+
##### 5. Minimum vs Recommended System Requirements:
|
|
133
|
+
* **Absolute Minimum System RAM**: **2 GB** (for default sequential diff-scoped `deployproof check`).
|
|
134
|
+
* **Minimum System RAM for Multi-Worker Mode (`--workers 4`)**: **4 GB**.
|
|
135
|
+
* **Recommended System RAM for Max-Throughput Parallel Mode (`--workers 8` or `16`)**: **16 GB** (provides sufficient headroom to keep 8 to 16 Python subprocesses and their entire sandboxes resident in physical memory).
|
|
136
|
+
|
|
137
|
+
Output includes a section for each check — symlink scan, secrets scan, dependency scan, mock detection, control flow analysis, and mutation score — with a pass/fail line at the bottom.
|
|
138
|
+
|
|
139
|
+
### Exit Codes:
|
|
140
|
+
* `0` — **PASSED**: All verification checks passed and mutation score meets threshold.
|
|
141
|
+
* `1` — **FAILED**: Code quality or security gate triggered (mutation score below threshold, untested files, hardcoded secrets, sandbox-escape symlinks, hallucinated packages, or strict flags).
|
|
142
|
+
* `2` — **ERROR**: Test environment failure (test suite failed to collect or execute before mutation testing began due to missing dependencies or broken imports).
|
|
143
|
+
|
|
144
|
+
### Example Walkthrough
|
|
145
|
+
|
|
146
|
+
Given a newly written function `calculator.py`:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
def calculate_discount(price: float, rate: float) -> float:
|
|
150
|
+
if rate > 0.5:
|
|
151
|
+
return price * 0.5
|
|
152
|
+
return price * (1.0 - rate)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
With an AI-generated test that achieves 100% line coverage by only asserting standard discounts (`rate = 0.2`):
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
def test_calculate_discount_basic():
|
|
159
|
+
assert calculate_discount(100.0, 0.2) == 80.0
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Running `deployproof check` mutates AST operators and detects that boundary conditions and threshold caps are untested:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
$ deployproof check
|
|
166
|
+
|
|
167
|
+
DeployProof - LOCAL PRE-CHECK (approximate) - not the verified score
|
|
168
|
+
====================================================================
|
|
169
|
+
|
|
170
|
+
Target Scope (1 file evaluated):
|
|
171
|
+
* calculator.py
|
|
172
|
+
|
|
173
|
+
Symlink & Sandbox Escape Scan (CWE-61/CWE-451):
|
|
174
|
+
Clean: No symlinks or sandbox-escape traversal links detected across 1 session file.
|
|
175
|
+
|
|
176
|
+
Secrets & Credentials Pre-Push Scan:
|
|
177
|
+
Clean: No hardcoded secrets or tracked .env files detected across 1 session file.
|
|
178
|
+
|
|
179
|
+
Dependency & Slopsquatting Scan (PyPI Registry & Age Analysis):
|
|
180
|
+
Clean: No new external packages introduced across 1 session file.
|
|
181
|
+
|
|
182
|
+
Mock Usage Introduced (flagged for review):
|
|
183
|
+
Clean: No modified test files in scope.
|
|
184
|
+
|
|
185
|
+
Control Flow & Error Handling (flagged for review):
|
|
186
|
+
Clean: No bare excepts, swallowed exceptions, or unreachable code detected across 1 session file.
|
|
187
|
+
|
|
188
|
+
Local Pre-Check Mutation Verification:
|
|
189
|
+
Score: 57.1% (4/7 mutants killed)
|
|
190
|
+
Status: FAILED (score 57.1% below 80.0%) (threshold: 80.0%)
|
|
191
|
+
Time: 2.27s
|
|
192
|
+
|
|
193
|
+
Skipped Constructs: None (No known unsupported constructs detected)
|
|
194
|
+
|
|
195
|
+
Surviving Mutants (3 unverified changes):
|
|
196
|
+
|
|
197
|
+
[1] calculator.py:2
|
|
198
|
+
Mutation: Replace numeric constant '0.5' with '1.5'
|
|
199
|
+
Original: if rate > 0.5:
|
|
200
|
+
Mutated: if rate > 1.5:
|
|
201
|
+
|
|
202
|
+
[2] calculator.py:3
|
|
203
|
+
Mutation: Replace numeric constant '0.5' with '1.5'
|
|
204
|
+
Original: return price * 0.5
|
|
205
|
+
Mutated: return price * 1.5
|
|
206
|
+
|
|
207
|
+
[3] calculator.py:3
|
|
208
|
+
Mutation: Replace binary operator '*' with '/'
|
|
209
|
+
Original: return price * 0.5
|
|
210
|
+
Mutated: return price / 0.5
|
|
211
|
+
|
|
212
|
+
====================================================================
|
|
213
|
+
Notice: Local pre-check only. Full verified score runs in CI on push (via mutmut).
|
|
214
|
+
Pre-check FAILED: Score 57.1% is below threshold 80.0% (3 surviving mutants).
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Adding tests for threshold cap (`rate = 0.8`) and exact boundary (`rate = 0.5`) kills all mutants:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
Local Pre-Check Mutation Verification:
|
|
221
|
+
Score: 100.0% (7/7 mutants killed)
|
|
222
|
+
Status: PASSED (threshold: 80.0%)
|
|
223
|
+
Time: 2.31s
|
|
224
|
+
|
|
225
|
+
Surviving Mutants: None (All generated mutants caught by test suite)
|
|
226
|
+
|
|
227
|
+
====================================================================
|
|
228
|
+
Notice: Local pre-check only. Full verified score runs in CI on push (via mutmut).
|
|
229
|
+
Pre-check clean: 100% of tested basic mutations caught.
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### CLI Options & Flags
|
|
233
|
+
|
|
234
|
+
| Flag | Description |
|
|
235
|
+
|---|---|
|
|
236
|
+
| `deployproof check` | Run all 6 pre-push verification checks (informational warnings for mocks and error handling). |
|
|
237
|
+
| `deployproof check --json` | Output structured, machine-readable JSON for CI/CD pipelines, IDEs, and automation. |
|
|
238
|
+
| `deployproof check --strict-mocks` | Fail the gate (exit code 1) if new `unittest.mock`, `mocker`, or `monkeypatch` usage is introduced. |
|
|
239
|
+
| `deployproof check --strict-error-handling` | Fail the gate (exit code 1) if bare excepts, swallowed exceptions, or dead code are detected. |
|
|
240
|
+
| `deployproof check --files <paths...>` | Explicitly evaluate specific files (bypasses git diff). |
|
|
241
|
+
| `deployproof check --threshold <float>` | Minimum mutation score percentage required to pass (default: `80.0`). |
|
|
242
|
+
| `deployproof check --base <ref>` | Base git ref (branch/commit/tag) to diff against. |
|
|
243
|
+
| `deployproof check --full-repo` | Audit all tracked files across the entire repository root (respecting `.gitignore`), using isolated parallel workers. |
|
|
244
|
+
| `deployproof check --workers <int>` | Set the number of isolated parallel worker processes for `--full-repo` scans (default: auto-detected CPU count capped at 8). |
|
|
245
|
+
| `deployproof check --wsl` | Delegate mutation testing to `mutmut` inside WSL (Windows only). |
|
|
246
|
+
|
|
247
|
+
> **Note:** `deployproof check --wsl` (Windows only) is newer and less battle-tested than the core checks — [file an issue](https://github.com/SVSPraveen/DeployProof/issues) if you hit something.
|
|
248
|
+
|
|
249
|
+
### Machine-Readable Output (`--json`)
|
|
250
|
+
|
|
251
|
+
DeployProof provides a stable structured JSON schema for CI/CD pipelines, IDEs, and automation:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
deployproof check --json
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
#### JSON Output Schema
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"version": "1.0.0",
|
|
262
|
+
"status": "passed",
|
|
263
|
+
"summary": {
|
|
264
|
+
"target_files_count": 1,
|
|
265
|
+
"mutation_score": 100.0,
|
|
266
|
+
"threshold": 80.0,
|
|
267
|
+
"secrets_found": 0,
|
|
268
|
+
"symlink_escapes_found": 0,
|
|
269
|
+
"dependency_findings": {
|
|
270
|
+
"high_risk": 0,
|
|
271
|
+
"medium_risk": 0,
|
|
272
|
+
"ok": 1,
|
|
273
|
+
"unknown": 0,
|
|
274
|
+
"unscanned": 0
|
|
275
|
+
},
|
|
276
|
+
"mock_usages_found": 0,
|
|
277
|
+
"control_flow_findings": 0,
|
|
278
|
+
"strict_mocks_active": false,
|
|
279
|
+
"strict_mocks_triggered": false,
|
|
280
|
+
"strict_error_handling_active": false,
|
|
281
|
+
"strict_error_handling_triggered": false
|
|
282
|
+
},
|
|
283
|
+
"scope": {
|
|
284
|
+
"target_files": [
|
|
285
|
+
{
|
|
286
|
+
"file": "app.py",
|
|
287
|
+
"loc": 45,
|
|
288
|
+
"is_large": false
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
"mutation_testing": {
|
|
293
|
+
"score": 100.0,
|
|
294
|
+
"threshold": 80.0,
|
|
295
|
+
"total_mutants": 6,
|
|
296
|
+
"killed_mutants": 6,
|
|
297
|
+
"survived_mutants_count": 0,
|
|
298
|
+
"duration_seconds": 1.2,
|
|
299
|
+
"surviving_mutants": [],
|
|
300
|
+
"skipped_constructs": [],
|
|
301
|
+
"untested_files": []
|
|
302
|
+
},
|
|
303
|
+
"secrets": {
|
|
304
|
+
"clean": true,
|
|
305
|
+
"files_scanned": 1,
|
|
306
|
+
"findings": []
|
|
307
|
+
},
|
|
308
|
+
"symlinks": {
|
|
309
|
+
"clean": true,
|
|
310
|
+
"files_scanned": 1,
|
|
311
|
+
"findings": []
|
|
312
|
+
},
|
|
313
|
+
"dependencies": {
|
|
314
|
+
"clean": true,
|
|
315
|
+
"total_scanned": 1,
|
|
316
|
+
"findings": [],
|
|
317
|
+
"unscanned_sources": []
|
|
318
|
+
},
|
|
319
|
+
"mocks": {
|
|
320
|
+
"clean": true,
|
|
321
|
+
"strict_gate_triggered": false,
|
|
322
|
+
"findings": []
|
|
323
|
+
},
|
|
324
|
+
"control_flow": {
|
|
325
|
+
"clean": true,
|
|
326
|
+
"strict_gate_triggered": false,
|
|
327
|
+
"findings": []
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## What It Checks
|
|
333
|
+
|
|
334
|
+
- **Mutation Score** — Mutates AST operators (`>=`, `==`, `and`, `or`, `*`, numeric constants, comparisons) in modified files and runs your test suite against each mutant. Reports surviving mutants and a percentage score. Does not use line coverage. Features atomic file restoration protected by `SIGINT`/`SIGTERM`/`SIGBREAK` signal handlers to ensure interrupted runs never leave mutated code on disk.
|
|
335
|
+
- **Secrets and Credentials** — Scans modified files for hardcoded API keys (OpenAI, Anthropic, AWS, GitHub, Stripe, private keys) and tracked `.env` files using pattern matching and entropy analysis.
|
|
336
|
+
- **Symlink and Sandbox Escape** — Resolves symbolic links and flags any whose target escapes the repository root (CWE-61 / CWE-451). Catches the class of path-traversal trick used in the GhostApproval disclosure (Wiz Research, July 2026).
|
|
337
|
+
- **Dependency and Slopsquatting** — For each new import, dynamic import (`importlib.import_module`, `__import__`), or manifest entry (including recursive `-r` includes) introduced in the diff, queries the PyPI JSON API and checks registration age. Packages that don't exist (HTTP 404) are flagged HIGH RISK; packages registered within the last 30 days are flagged MEDIUM RISK.
|
|
338
|
+
- **Mock Usage Detection** — Scans test diffs for newly introduced imports or fixture uses of `unittest.mock`, `mocker`, and `monkeypatch`, flagging them for human review with an optional `--strict-mocks` hard gate.
|
|
339
|
+
- **Control Flow and Error Handling** — AST-based detector for bare `except:` without re-raise, silently swallowed broad exceptions (`except Exception:` that only `pass` or log/print without re-raising or returning error indicators), and dead/unreachable code following unconditional `return`, `raise`, `break`, or `continue`, with an optional `--strict-error-handling` hard gate.
|
|
340
|
+
|
|
341
|
+
## What This Doesn't Do
|
|
342
|
+
|
|
343
|
+
- **Test-only diffs are not yet caught.** If a diff modifies or weakens assertions in a test file without changing the corresponding source file, DeployProof currently sees zero modified source lines and passes with 0 mutants evaluated. This is a known gap — see [INVESTIGATION_blastradius.md](INVESTIGATION_blastradius.md) for the reverse-mapping approach being evaluated to close it. Until this lands, DeployProof does not protect against test suites being weakened directly.
|
|
344
|
+
- **Diff-scoping vs Full Audits:** Standard `deployproof check` is intentionally scoped strictly to files modified in the active git diff (for 2–5s speed). To audit every file in the entire repository, explicitly pass the `--full-repo` flag.
|
|
345
|
+
- **Python only.** Mutation testing and import extraction currently support Python files only. Other languages are not scanned.
|
|
346
|
+
- **No auto-fix.** DeployProof reports findings; it does not modify your code, rewrite imports, or suggest patches.
|
|
347
|
+
- **No IDE plugin yet.** There is no VS Code extension or JetBrains plugin. The CLI is the interface. IDE integration is on the roadmap.
|
|
348
|
+
|
|
349
|
+
## See It Catch Real Bugs
|
|
350
|
+
|
|
351
|
+
Clone this repository and run the standalone stress-test suite to see DeployProof evaluate 11 planted edge cases:
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
python stress_fixtures/run_stress_tests.py
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Fixtures cover weak test suites, zero-test orphan modules, planted OpenAI/AWS credentials, GhostApproval sandbox-escape traps, swallowed exceptions/dead code, and mock-masked broken implementations.
|
|
358
|
+
|
|
359
|
+
## Status & Roadmap
|
|
360
|
+
|
|
361
|
+
- **Current (v1.0.0):** Diff-scoped AST mutation testing (with recursive discovery and `SIGINT`/`SIGTERM`/`SIGBREAK` signal-safe disk restoration), **Full Repository Audit Mode (`--full-repo`)** with isolated parallel multi-worker sandboxes and AST import-graph test discovery, baseline test-collection failure isolation with distinct exit code `2`, entropy-driven value-based secrets scanner, GhostApproval symlink sandbox-escape detector, PyPI dependency hallucination / slopsquatting scanner (with import-to-distribution translation, recursive `-r` requirements scanning, and dynamic import detection via `importlib` / `__import__`), mock-introduction detector (`--strict-mocks`), control-flow / swallowed-exception scanner (`--strict-error-handling`), 11/11 launch-day stress test suite, **111 unit tests**, live unbuffered progress streaming, and machine-readable `--json` output.
|
|
362
|
+
- **Next:** Reverse test-to-source dependency mapping (see `FUTURE_SCOPE.md`), SARIF 2.1.0 PR annotations, and multi-language mutation rule packs.
|
|
363
|
+
|
|
364
|
+
## Contributing
|
|
365
|
+
|
|
366
|
+
Issues and pull requests are welcome. Open an issue first for significant changes so the approach can be discussed before implementation.
|
|
367
|
+
|
|
368
|
+
## License
|
|
369
|
+
|
|
370
|
+
MIT. See [LICENSE](LICENSE).
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
*Created by [SVS Praveen](https://github.com/SVSPraveen) · [Portfolio](https://svspraveen.vercel.app/) · [LinkedIn](https://www.linkedin.com/in/svs-praveen-s/)*
|
|
375
|
+
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "deployproof"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "1.0.1"
|
|
8
8
|
description = "A deterministic AI-code deployability checker that catches what coverage misses."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -41,6 +41,7 @@ dev = [
|
|
|
41
41
|
"pytest>=7.0.0",
|
|
42
42
|
"build>=1.0.0",
|
|
43
43
|
"twine>=4.0.0",
|
|
44
|
+
"coverage>=7.0.0",
|
|
44
45
|
]
|
|
45
46
|
|
|
46
47
|
[project.urls]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""DeployProof - Deterministic AI-Code Deployability Checker."""
|
|
2
|
-
__version__ = "0.
|
|
2
|
+
__version__ = "1.0.1"
|