integrity-evidence-gate 0.1.0__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.
- integrity_evidence_gate-0.1.0/LICENSE +21 -0
- integrity_evidence_gate-0.1.0/PKG-INFO +187 -0
- integrity_evidence_gate-0.1.0/README.md +159 -0
- integrity_evidence_gate-0.1.0/evidence_gate/__init__.py +31 -0
- integrity_evidence_gate-0.1.0/evidence_gate/__main__.py +10 -0
- integrity_evidence_gate-0.1.0/evidence_gate/core.py +467 -0
- integrity_evidence_gate-0.1.0/evidence_gate/runner.py +183 -0
- integrity_evidence_gate-0.1.0/evidence_gate/storage.py +417 -0
- integrity_evidence_gate-0.1.0/integrity_evidence_gate.egg-info/PKG-INFO +187 -0
- integrity_evidence_gate-0.1.0/integrity_evidence_gate.egg-info/SOURCES.txt +14 -0
- integrity_evidence_gate-0.1.0/integrity_evidence_gate.egg-info/dependency_links.txt +1 -0
- integrity_evidence_gate-0.1.0/integrity_evidence_gate.egg-info/entry_points.txt +2 -0
- integrity_evidence_gate-0.1.0/integrity_evidence_gate.egg-info/top_level.txt +1 -0
- integrity_evidence_gate-0.1.0/pyproject.toml +48 -0
- integrity_evidence_gate-0.1.0/setup.cfg +4 -0
- integrity_evidence_gate-0.1.0/tests/test_evidence_gate.py +901 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BlackBadHope
|
|
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,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: integrity-evidence-gate
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Digest-bound test execution cache and rate-limited monitor gate for autonomous AI coding agents.
|
|
5
|
+
Author: BlackBadHope
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://integrity.subnet.zp.ua
|
|
8
|
+
Project-URL: Repository, https://github.com/BlackBadHope/evidence-gate
|
|
9
|
+
Project-URL: Issues, https://github.com/BlackBadHope/evidence-gate/issues
|
|
10
|
+
Keywords: ai-agents,claude-code,codex,cursor,testing,evidence,ci,governance
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development :: Testing
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# evidence-gate
|
|
30
|
+
|
|
31
|
+
[](https://github.com/BlackBadHope/evidence-gate/actions/workflows/ci.yml)
|
|
32
|
+
|
|
33
|
+
**SHA-256 digest-bound test execution cache and rate-limited monitor gate for autonomous AI coding agents** (Claude Code, Codex CLI, Cursor, Antigravity, Aider, Windsurf, CI runners).
|
|
34
|
+
|
|
35
|
+
Autonomous coding agents burn 30–60% of their context window and API budget re-running identical passing test suites and polling unchanged CI/deploy logs in tight loops. `evidence-gate` stops both deterministically:
|
|
36
|
+
|
|
37
|
+
- **Zero runtime dependencies** — pure Python 3.10+ standard library.
|
|
38
|
+
- **Digest-bound PASS reuse (`run`):** hashes target files/directories (symlink-safe SHA-256, ignoring `.git`/`__pycache__`/`node_modules`), OS/Python environment fingerprint, and exact command argv. If an identical PASS already exists in the append-only JSONL ledger, returns `SKIP_CACHED_PASS` in milliseconds with `command_calls=0`.
|
|
39
|
+
- **Fail-safe invalidation:** failed runs are never cached; any 1-byte change in any watched artifact invalidates the key immediately; `--force` requires an explicit `--force-reason` audit trail.
|
|
40
|
+
- **Bounded monitor polling (`observe`):** enforces `--min-interval-seconds`, `--deadline-utc`, and `--max-unchanged` consecutive identical-output loop breaking (`STOP_UNCHANGED`, `STOP_DEADLINE`, `SKIP_TOO_SOON`).
|
|
41
|
+
- **Concurrency & integrity:** atomic `O_CREAT | O_EXCL` file lease (`exit 75` on active duplicate run, automatic stale-lock reclamation), atomic `os.replace` state updates, `0o600`/`0o700` private permissions, `shell=False` always.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Evidence Ladder (E0–E4)
|
|
46
|
+
|
|
47
|
+
Pair `evidence-gate` with a progressive verification budget so agents start with the smallest proving gate instead of running full suites on every edit:
|
|
48
|
+
|
|
49
|
+
| Level | `--kind` | Typical scope | Freshness default |
|
|
50
|
+
|---|---|---|---|
|
|
51
|
+
| **E0** | `static` | Linter / typecheck / schema check on edited files | `artifact` |
|
|
52
|
+
| **E1** | `targeted` | Single failing/changed unit test module | `artifact` |
|
|
53
|
+
| **E2** | `impacted` | Affected package test suite | `artifact` |
|
|
54
|
+
| **E3** | `smoke` / `replay` | End-to-end smoke or fixture replay | `ttl` or `artifact` |
|
|
55
|
+
| **E4** | `full` | Full repository suite before release/PR | `artifact` |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 60-Second Quickstart
|
|
60
|
+
|
|
61
|
+
> **PyPI package-name warning:** Do **NOT** run `pip install evidence-gate`. The unscoped `evidence-gate` name on PyPI is owned by an unrelated third party (`blazingRadar`). The official PyPI distribution for this repository is **`integrity-evidence-gate`** (which provides the `evidence-gate` CLI command and the `evidence_gate` Python module).
|
|
62
|
+
|
|
63
|
+
**1-line zero-friction usage** (auto-defaults to `--kind targeted`, `--reason cli-run`, deterministic `--suite-id auto-<sha256>`, and current directory as watched artifact):
|
|
64
|
+
|
|
65
|
+
### Linux / macOS (`bash`)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Zero-install standalone script (pure Python 3.10+ stdlib)
|
|
69
|
+
python3 agensi-skill-pack/evidence-test-gate/scripts/evidence_test.py -- pytest
|
|
70
|
+
|
|
71
|
+
# Or via the CLI shim / installed command
|
|
72
|
+
python3 evidence_gate_cli.py run -- pytest
|
|
73
|
+
evidence-gate run -- pytest
|
|
74
|
+
|
|
75
|
+
# Isolated install from source via pipx or .venv (PEP 668 / Ubuntu 24.04 safe)
|
|
76
|
+
pipx install .
|
|
77
|
+
python3 -m venv .venv && .venv/bin/python -m pip install --no-deps .
|
|
78
|
+
.venv/bin/evidence-gate run -- pytest
|
|
79
|
+
|
|
80
|
+
# Once published on PyPI (ALWAYS use `integrity-evidence-gate`, NEVER `evidence-gate`):
|
|
81
|
+
# pipx install integrity-evidence-gate
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Windows (`pwsh 7`)
|
|
85
|
+
|
|
86
|
+
```powershell
|
|
87
|
+
# Zero-install standalone script (pure Python 3.10+ stdlib)
|
|
88
|
+
python agensi-skill-pack\evidence-test-gate\scripts\evidence_test.py -- pytest
|
|
89
|
+
|
|
90
|
+
# Or via the CLI shim
|
|
91
|
+
python evidence_gate_cli.py run -- pytest
|
|
92
|
+
|
|
93
|
+
# Isolated virtual environment (.venv) from source
|
|
94
|
+
python -m venv .venv
|
|
95
|
+
.\.venv\Scripts\python.exe -m pip install --no-deps .
|
|
96
|
+
.\.venv\Scripts\evidence-gate.exe run -- pytest
|
|
97
|
+
|
|
98
|
+
# Once published on PyPI (ALWAYS use `integrity-evidence-gate`, NEVER `evidence-gate`):
|
|
99
|
+
# .\.venv\Scripts\python.exe -m pip install integrity-evidence-gate
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Core Commands
|
|
105
|
+
|
|
106
|
+
### 1. Digest-bound test gate (`run`)
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Zero-flag 1-liner: cold run -> EXECUTED, immediate repeat -> SKIP_CACHED_PASS (0 command calls)
|
|
110
|
+
evidence-gate run -- pytest
|
|
111
|
+
python3 agensi-skill-pack/evidence-test-gate/scripts/evidence_test.py -- pytest
|
|
112
|
+
|
|
113
|
+
# Full explicit form: narrow watched artifacts and record audit metadata
|
|
114
|
+
evidence-gate run \
|
|
115
|
+
--kind targeted \
|
|
116
|
+
--suite-id auth-unit \
|
|
117
|
+
--reason "verify token parser fix" \
|
|
118
|
+
--artifact src/auth \
|
|
119
|
+
--artifact tests/test_auth.py \
|
|
120
|
+
-- python -m unittest tests/test_auth.py
|
|
121
|
+
|
|
122
|
+
# Second run with unchanged artifacts -> instant SKIP_CACHED_PASS (0 command calls, 1-line summary)
|
|
123
|
+
evidence-gate run \
|
|
124
|
+
--kind targeted \
|
|
125
|
+
--suite-id auth-unit \
|
|
126
|
+
--reason "re-check before commit" \
|
|
127
|
+
--artifact src/auth \
|
|
128
|
+
--artifact tests/test_auth.py \
|
|
129
|
+
-- python -m unittest tests/test_auth.py
|
|
130
|
+
|
|
131
|
+
# Force a fresh run with mandatory audit reason
|
|
132
|
+
evidence-gate run \
|
|
133
|
+
--kind smoke \
|
|
134
|
+
--suite-id api-health \
|
|
135
|
+
--reason "post-restart verification" \
|
|
136
|
+
--freshness volatile \
|
|
137
|
+
--force --force-reason "container restarted externally" \
|
|
138
|
+
-- python scripts/smoke_check.py
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 2. Rate-limited, loop-breaking monitor (`observe`)
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Take at most 1 sample every 60s, stop after 3 identical outputs or after deadline
|
|
145
|
+
evidence-gate observe \
|
|
146
|
+
--monitor-id deploy-rollout \
|
|
147
|
+
--reason "watch staging rollout" \
|
|
148
|
+
--deadline-utc 2026-12-31T23:59:59Z \
|
|
149
|
+
--min-interval-seconds 60 \
|
|
150
|
+
--max-unchanged 3 \
|
|
151
|
+
--json \
|
|
152
|
+
-- python scripts/check_rollout.py
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Exit Codes
|
|
156
|
+
|
|
157
|
+
| Exit code | Meaning |
|
|
158
|
+
|---|---|
|
|
159
|
+
| `0` | Command passed, `SKIP_CACHED_PASS`, `SKIP_TOO_SOON`, or `STOP_DEADLINE` |
|
|
160
|
+
| `2` | `PolicyError` (nonexistent `--artifact`, `--force` without `--force-reason`, invalid TTL/cwd/command) |
|
|
161
|
+
| `75` | `BusyError` (`SKIP_BUSY` — an identical run/monitor already holds the `FileLease`) |
|
|
162
|
+
| `<rc>` | Underlying command's non-zero exit code (with compact `failure_tail:` on stdout) |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Guarantee & Threat Model
|
|
167
|
+
|
|
168
|
+
- **What `evidence-gate` guarantees:** deterministic SHA-256 key binding over declared `--artifact` paths + OS/Python/cwd + command argv; append-only JSONL audit ledger; zero shell injection (`shell=False`); strict concurrency exclusion via `O_CREAT | O_EXCL`.
|
|
169
|
+
- **Boundary you must respect:** if a test depends on external mutable state (live database, remote API, clock, undeclared config file), either pass the config as an `--artifact`, use `--freshness ttl --ttl-seconds N`, or mark it `--freshness volatile`. The gate can only hash what you declare.
|
|
170
|
+
- State defaults to `~/.evidence-gate` (override via `EVIDENCE_GATE_HOME` or `--ledger`/`--logs-dir`/`--state-dir`).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Development & Verification
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
ruff check evidence_gate evidence_gate_cli.py tests agensi-skill-pack
|
|
178
|
+
python -m unittest discover -s tests -p "test_*.py" -v
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Project Homepage
|
|
182
|
+
|
|
183
|
+
- **Integrity Harness & Cloud Control Plane:** [integrity.subnet.zp.ua](https://integrity.subnet.zp.ua)
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# evidence-gate
|
|
2
|
+
|
|
3
|
+
[](https://github.com/BlackBadHope/evidence-gate/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
**SHA-256 digest-bound test execution cache and rate-limited monitor gate for autonomous AI coding agents** (Claude Code, Codex CLI, Cursor, Antigravity, Aider, Windsurf, CI runners).
|
|
6
|
+
|
|
7
|
+
Autonomous coding agents burn 30–60% of their context window and API budget re-running identical passing test suites and polling unchanged CI/deploy logs in tight loops. `evidence-gate` stops both deterministically:
|
|
8
|
+
|
|
9
|
+
- **Zero runtime dependencies** — pure Python 3.10+ standard library.
|
|
10
|
+
- **Digest-bound PASS reuse (`run`):** hashes target files/directories (symlink-safe SHA-256, ignoring `.git`/`__pycache__`/`node_modules`), OS/Python environment fingerprint, and exact command argv. If an identical PASS already exists in the append-only JSONL ledger, returns `SKIP_CACHED_PASS` in milliseconds with `command_calls=0`.
|
|
11
|
+
- **Fail-safe invalidation:** failed runs are never cached; any 1-byte change in any watched artifact invalidates the key immediately; `--force` requires an explicit `--force-reason` audit trail.
|
|
12
|
+
- **Bounded monitor polling (`observe`):** enforces `--min-interval-seconds`, `--deadline-utc`, and `--max-unchanged` consecutive identical-output loop breaking (`STOP_UNCHANGED`, `STOP_DEADLINE`, `SKIP_TOO_SOON`).
|
|
13
|
+
- **Concurrency & integrity:** atomic `O_CREAT | O_EXCL` file lease (`exit 75` on active duplicate run, automatic stale-lock reclamation), atomic `os.replace` state updates, `0o600`/`0o700` private permissions, `shell=False` always.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Evidence Ladder (E0–E4)
|
|
18
|
+
|
|
19
|
+
Pair `evidence-gate` with a progressive verification budget so agents start with the smallest proving gate instead of running full suites on every edit:
|
|
20
|
+
|
|
21
|
+
| Level | `--kind` | Typical scope | Freshness default |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| **E0** | `static` | Linter / typecheck / schema check on edited files | `artifact` |
|
|
24
|
+
| **E1** | `targeted` | Single failing/changed unit test module | `artifact` |
|
|
25
|
+
| **E2** | `impacted` | Affected package test suite | `artifact` |
|
|
26
|
+
| **E3** | `smoke` / `replay` | End-to-end smoke or fixture replay | `ttl` or `artifact` |
|
|
27
|
+
| **E4** | `full` | Full repository suite before release/PR | `artifact` |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 60-Second Quickstart
|
|
32
|
+
|
|
33
|
+
> **PyPI package-name warning:** Do **NOT** run `pip install evidence-gate`. The unscoped `evidence-gate` name on PyPI is owned by an unrelated third party (`blazingRadar`). The official PyPI distribution for this repository is **`integrity-evidence-gate`** (which provides the `evidence-gate` CLI command and the `evidence_gate` Python module).
|
|
34
|
+
|
|
35
|
+
**1-line zero-friction usage** (auto-defaults to `--kind targeted`, `--reason cli-run`, deterministic `--suite-id auto-<sha256>`, and current directory as watched artifact):
|
|
36
|
+
|
|
37
|
+
### Linux / macOS (`bash`)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Zero-install standalone script (pure Python 3.10+ stdlib)
|
|
41
|
+
python3 agensi-skill-pack/evidence-test-gate/scripts/evidence_test.py -- pytest
|
|
42
|
+
|
|
43
|
+
# Or via the CLI shim / installed command
|
|
44
|
+
python3 evidence_gate_cli.py run -- pytest
|
|
45
|
+
evidence-gate run -- pytest
|
|
46
|
+
|
|
47
|
+
# Isolated install from source via pipx or .venv (PEP 668 / Ubuntu 24.04 safe)
|
|
48
|
+
pipx install .
|
|
49
|
+
python3 -m venv .venv && .venv/bin/python -m pip install --no-deps .
|
|
50
|
+
.venv/bin/evidence-gate run -- pytest
|
|
51
|
+
|
|
52
|
+
# Once published on PyPI (ALWAYS use `integrity-evidence-gate`, NEVER `evidence-gate`):
|
|
53
|
+
# pipx install integrity-evidence-gate
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Windows (`pwsh 7`)
|
|
57
|
+
|
|
58
|
+
```powershell
|
|
59
|
+
# Zero-install standalone script (pure Python 3.10+ stdlib)
|
|
60
|
+
python agensi-skill-pack\evidence-test-gate\scripts\evidence_test.py -- pytest
|
|
61
|
+
|
|
62
|
+
# Or via the CLI shim
|
|
63
|
+
python evidence_gate_cli.py run -- pytest
|
|
64
|
+
|
|
65
|
+
# Isolated virtual environment (.venv) from source
|
|
66
|
+
python -m venv .venv
|
|
67
|
+
.\.venv\Scripts\python.exe -m pip install --no-deps .
|
|
68
|
+
.\.venv\Scripts\evidence-gate.exe run -- pytest
|
|
69
|
+
|
|
70
|
+
# Once published on PyPI (ALWAYS use `integrity-evidence-gate`, NEVER `evidence-gate`):
|
|
71
|
+
# .\.venv\Scripts\python.exe -m pip install integrity-evidence-gate
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Core Commands
|
|
77
|
+
|
|
78
|
+
### 1. Digest-bound test gate (`run`)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Zero-flag 1-liner: cold run -> EXECUTED, immediate repeat -> SKIP_CACHED_PASS (0 command calls)
|
|
82
|
+
evidence-gate run -- pytest
|
|
83
|
+
python3 agensi-skill-pack/evidence-test-gate/scripts/evidence_test.py -- pytest
|
|
84
|
+
|
|
85
|
+
# Full explicit form: narrow watched artifacts and record audit metadata
|
|
86
|
+
evidence-gate run \
|
|
87
|
+
--kind targeted \
|
|
88
|
+
--suite-id auth-unit \
|
|
89
|
+
--reason "verify token parser fix" \
|
|
90
|
+
--artifact src/auth \
|
|
91
|
+
--artifact tests/test_auth.py \
|
|
92
|
+
-- python -m unittest tests/test_auth.py
|
|
93
|
+
|
|
94
|
+
# Second run with unchanged artifacts -> instant SKIP_CACHED_PASS (0 command calls, 1-line summary)
|
|
95
|
+
evidence-gate run \
|
|
96
|
+
--kind targeted \
|
|
97
|
+
--suite-id auth-unit \
|
|
98
|
+
--reason "re-check before commit" \
|
|
99
|
+
--artifact src/auth \
|
|
100
|
+
--artifact tests/test_auth.py \
|
|
101
|
+
-- python -m unittest tests/test_auth.py
|
|
102
|
+
|
|
103
|
+
# Force a fresh run with mandatory audit reason
|
|
104
|
+
evidence-gate run \
|
|
105
|
+
--kind smoke \
|
|
106
|
+
--suite-id api-health \
|
|
107
|
+
--reason "post-restart verification" \
|
|
108
|
+
--freshness volatile \
|
|
109
|
+
--force --force-reason "container restarted externally" \
|
|
110
|
+
-- python scripts/smoke_check.py
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 2. Rate-limited, loop-breaking monitor (`observe`)
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Take at most 1 sample every 60s, stop after 3 identical outputs or after deadline
|
|
117
|
+
evidence-gate observe \
|
|
118
|
+
--monitor-id deploy-rollout \
|
|
119
|
+
--reason "watch staging rollout" \
|
|
120
|
+
--deadline-utc 2026-12-31T23:59:59Z \
|
|
121
|
+
--min-interval-seconds 60 \
|
|
122
|
+
--max-unchanged 3 \
|
|
123
|
+
--json \
|
|
124
|
+
-- python scripts/check_rollout.py
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Exit Codes
|
|
128
|
+
|
|
129
|
+
| Exit code | Meaning |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `0` | Command passed, `SKIP_CACHED_PASS`, `SKIP_TOO_SOON`, or `STOP_DEADLINE` |
|
|
132
|
+
| `2` | `PolicyError` (nonexistent `--artifact`, `--force` without `--force-reason`, invalid TTL/cwd/command) |
|
|
133
|
+
| `75` | `BusyError` (`SKIP_BUSY` — an identical run/monitor already holds the `FileLease`) |
|
|
134
|
+
| `<rc>` | Underlying command's non-zero exit code (with compact `failure_tail:` on stdout) |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Guarantee & Threat Model
|
|
139
|
+
|
|
140
|
+
- **What `evidence-gate` guarantees:** deterministic SHA-256 key binding over declared `--artifact` paths + OS/Python/cwd + command argv; append-only JSONL audit ledger; zero shell injection (`shell=False`); strict concurrency exclusion via `O_CREAT | O_EXCL`.
|
|
141
|
+
- **Boundary you must respect:** if a test depends on external mutable state (live database, remote API, clock, undeclared config file), either pass the config as an `--artifact`, use `--freshness ttl --ttl-seconds N`, or mark it `--freshness volatile`. The gate can only hash what you declare.
|
|
142
|
+
- State defaults to `~/.evidence-gate` (override via `EVIDENCE_GATE_HOME` or `--ledger`/`--logs-dir`/`--state-dir`).
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Development & Verification
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
ruff check evidence_gate evidence_gate_cli.py tests agensi-skill-pack
|
|
150
|
+
python -m unittest discover -s tests -p "test_*.py" -v
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Project Homepage
|
|
154
|
+
|
|
155
|
+
- **Integrity Harness & Cloud Control Plane:** [integrity.subnet.zp.ua](https://integrity.subnet.zp.ua)
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Digest-bound test execution cache and rate-limited monitor gate."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from evidence_gate.core import build_parser, main, observe, run_evidence
|
|
6
|
+
from evidence_gate.runner import find_cached_pass, parse_test_count
|
|
7
|
+
from evidence_gate.storage import (
|
|
8
|
+
POLICY_VERSION,
|
|
9
|
+
SCHEMA_VERSION,
|
|
10
|
+
BusyError,
|
|
11
|
+
FileLease,
|
|
12
|
+
PolicyError,
|
|
13
|
+
environment_fingerprint,
|
|
14
|
+
hash_artifacts,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"POLICY_VERSION",
|
|
19
|
+
"SCHEMA_VERSION",
|
|
20
|
+
"BusyError",
|
|
21
|
+
"FileLease",
|
|
22
|
+
"PolicyError",
|
|
23
|
+
"build_parser",
|
|
24
|
+
"environment_fingerprint",
|
|
25
|
+
"find_cached_pass",
|
|
26
|
+
"hash_artifacts",
|
|
27
|
+
"main",
|
|
28
|
+
"observe",
|
|
29
|
+
"parse_test_count",
|
|
30
|
+
"run_evidence",
|
|
31
|
+
]
|