verdity 0.2.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.
- verdity-0.2.0/.env.example +26 -0
- verdity-0.2.0/LICENSE +21 -0
- verdity-0.2.0/MANIFEST.in +14 -0
- verdity-0.2.0/PKG-INFO +359 -0
- verdity-0.2.0/README.md +316 -0
- verdity-0.2.0/SECURITY.md +56 -0
- verdity-0.2.0/dev-notes/01-Product-Requirements-Document.md +129 -0
- verdity-0.2.0/dev-notes/02-Technical-Architecture-Document.md +143 -0
- verdity-0.2.0/dev-notes/03-API-Webhook-Specification.md +185 -0
- verdity-0.2.0/dev-notes/04-Security-Threat-Model.md +86 -0
- verdity-0.2.0/dev-notes/05-Agent-Orchestration-Design.md +141 -0
- verdity-0.2.0/dev-notes/GOAL.md +138 -0
- verdity-0.2.0/dev-notes/PHASE-01-GATE.md +78 -0
- verdity-0.2.0/dev-notes/PHASE-02-GATE.md +50 -0
- verdity-0.2.0/dev-notes/PHASE-03-GATE.md +58 -0
- verdity-0.2.0/dev-notes/PHASE-04-GATE.md +48 -0
- verdity-0.2.0/dev-notes/PHASE-05-GATE.md +61 -0
- verdity-0.2.0/dev-notes/PHASE-06-GATE.md +60 -0
- verdity-0.2.0/dev-notes/PHASE-07-GATE.md +59 -0
- verdity-0.2.0/dev-notes/PHASE-08-GATE.md +92 -0
- verdity-0.2.0/dev-notes/SECURITY-AUDIT.md +197 -0
- verdity-0.2.0/pyproject.toml +80 -0
- verdity-0.2.0/setup.cfg +4 -0
- verdity-0.2.0/src/verdity/__init__.py +6 -0
- verdity-0.2.0/src/verdity/agents/__init__.py +17 -0
- verdity-0.2.0/src/verdity/agents/base.py +105 -0
- verdity-0.2.0/src/verdity/agents/code_quality.py +92 -0
- verdity-0.2.0/src/verdity/agents/documentation.py +74 -0
- verdity-0.2.0/src/verdity/agents/security.py +274 -0
- verdity-0.2.0/src/verdity/agents/testing.py +74 -0
- verdity-0.2.0/src/verdity/aggregator.py +158 -0
- verdity-0.2.0/src/verdity/approval_queue.py +156 -0
- verdity-0.2.0/src/verdity/async_sqlite.py +69 -0
- verdity-0.2.0/src/verdity/audit_store.py +133 -0
- verdity-0.2.0/src/verdity/budget_enforcer.py +184 -0
- verdity-0.2.0/src/verdity/coding_agent.py +166 -0
- verdity-0.2.0/src/verdity/config.py +87 -0
- verdity-0.2.0/src/verdity/event_queue.py +214 -0
- verdity-0.2.0/src/verdity/gateway/__init__.py +7 -0
- verdity-0.2.0/src/verdity/gateway/app.py +253 -0
- verdity-0.2.0/src/verdity/github_client.py +256 -0
- verdity-0.2.0/src/verdity/hmac_verify.py +60 -0
- verdity-0.2.0/src/verdity/orchestrator.py +377 -0
- verdity-0.2.0/src/verdity/rate_limiter.py +192 -0
- verdity-0.2.0/src/verdity/router.py +116 -0
- verdity-0.2.0/src/verdity/schemas/__init__.py +39 -0
- verdity-0.2.0/src/verdity/schemas/_models.py +176 -0
- verdity-0.2.0/src/verdity/semantic_index.py +429 -0
- verdity-0.2.0/src/verdity/token_economics.py +264 -0
- verdity-0.2.0/src/verdity/verification_gate.py +254 -0
- verdity-0.2.0/src/verdity/webhook_normalizer.py +98 -0
- verdity-0.2.0/src/verdity/worker.py +220 -0
- verdity-0.2.0/src/verdity.egg-info/PKG-INFO +359 -0
- verdity-0.2.0/src/verdity.egg-info/SOURCES.txt +74 -0
- verdity-0.2.0/src/verdity.egg-info/dependency_links.txt +1 -0
- verdity-0.2.0/src/verdity.egg-info/entry_points.txt +2 -0
- verdity-0.2.0/src/verdity.egg-info/requires.txt +12 -0
- verdity-0.2.0/src/verdity.egg-info/top_level.txt +1 -0
- verdity-0.2.0/tests/conftest.py +142 -0
- verdity-0.2.0/tests/test_audit_store.py +99 -0
- verdity-0.2.0/tests/test_coverage.py +2598 -0
- verdity-0.2.0/tests/test_event_queue.py +153 -0
- verdity-0.2.0/tests/test_gateway.py +197 -0
- verdity-0.2.0/tests/test_github_client.py +444 -0
- verdity-0.2.0/tests/test_hmac_verify.py +101 -0
- verdity-0.2.0/tests/test_orchestrator.py +362 -0
- verdity-0.2.0/tests/test_phase4.py +264 -0
- verdity-0.2.0/tests/test_phase5.py +182 -0
- verdity-0.2.0/tests/test_phase6.py +217 -0
- verdity-0.2.0/tests/test_phase7.py +135 -0
- verdity-0.2.0/tests/test_phase8.py +468 -0
- verdity-0.2.0/tests/test_rate_limiter.py +265 -0
- verdity-0.2.0/tests/test_semantic_index.py +196 -0
- verdity-0.2.0/tests/test_token_economics.py +170 -0
- verdity-0.2.0/tests/test_webhook_normalizer.py +105 -0
- verdity-0.2.0/tests/test_worker.py +640 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Environment variables for Verdity
|
|
2
|
+
# DO NOT commit real values — this is a template.
|
|
3
|
+
|
|
4
|
+
# ── Required ──────────────────────────────────────────────────────────
|
|
5
|
+
# HMAC secret for GitHub webhook verification (dev-only secret for local dev)
|
|
6
|
+
WEBHOOK_HMAC_SECRET=dev-webhook-secret-do-not-use-in-prod
|
|
7
|
+
|
|
8
|
+
# GitHub App credentials (from managed secret store in prod)
|
|
9
|
+
GITHUB_APP_ID=0
|
|
10
|
+
GITHUB_APP_INSTALLATION_ID=
|
|
11
|
+
GITHUB_APP_PRIVATE_KEY=
|
|
12
|
+
|
|
13
|
+
# ── Optional ──────────────────────────────────────────────────────────
|
|
14
|
+
# Queue backend: "sqlite" (dev) or "redis" (prod)
|
|
15
|
+
QUEUE_BACKEND=sqlite
|
|
16
|
+
QUEUE_SQLITE_PATH=:memory:
|
|
17
|
+
|
|
18
|
+
# Audit store path
|
|
19
|
+
AUDIT_SQLITE_PATH=audit_store.db
|
|
20
|
+
|
|
21
|
+
# Budget caps (0 = unlimited)
|
|
22
|
+
DEFAULT_REPO_BUDGET_USD=0.0
|
|
23
|
+
DEFAULT_ORG_BUDGET_USD=0.0
|
|
24
|
+
|
|
25
|
+
# Secret rotation (previous secret, empty during normal operation)
|
|
26
|
+
WEBHOOK_HMAC_SECRET_PREVIOUS=
|
verdity-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Verdity Contributors
|
|
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,14 @@
|
|
|
1
|
+
# MANIFEST.in — include non-Python files in source distributions
|
|
2
|
+
|
|
3
|
+
include LICENSE
|
|
4
|
+
include README.md
|
|
5
|
+
include SECURITY.md
|
|
6
|
+
include .env.example
|
|
7
|
+
include pyproject.toml
|
|
8
|
+
recursive-include dev-notes *
|
|
9
|
+
graft tests
|
|
10
|
+
global-exclude __pycache__
|
|
11
|
+
global-exclude *.py[cod]
|
|
12
|
+
global-exclude *.db
|
|
13
|
+
global-exclude .pytest_cache
|
|
14
|
+
global-exclude .verdity-tests
|
verdity-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: verdity
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Verdity — AI-Powered Pull Request Review System with security-first architecture
|
|
5
|
+
Author: Verdity Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Dream-Pixels-Forge/verdity
|
|
8
|
+
Project-URL: Documentation, https://github.com/Dream-Pixels-Forge/verdity#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/Dream-Pixels-Forge/verdity
|
|
10
|
+
Project-URL: Issues, https://github.com/Dream-Pixels-Forge/verdity/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/Dream-Pixels-Forge/verdity/blob/main/CHANGELOG.md
|
|
12
|
+
Project-URL: Security, https://github.com/Dream-Pixels-Forge/verdity/blob/main/SECURITY.md
|
|
13
|
+
Keywords: pr-review,code-review,security,ai-agent,github,webhook,llm,static-analysis,secrets-detection
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Environment :: Web Environment
|
|
16
|
+
Classifier: Framework :: FastAPI
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
26
|
+
Classifier: Topic :: Security
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: fastapi>=0.111.0
|
|
32
|
+
Requires-Dist: uvicorn[standard]>=0.29.0
|
|
33
|
+
Requires-Dist: pydantic>=2.6.0
|
|
34
|
+
Requires-Dist: pydantic-settings>=2.2.0
|
|
35
|
+
Requires-Dist: httpx>=0.27.0
|
|
36
|
+
Requires-Dist: PyJWT>=2.8.0
|
|
37
|
+
Requires-Dist: cryptography>=42.0.0
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: pytest>=8.1.0; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# Verdity — AI-Powered Pull Request Review System
|
|
45
|
+
|
|
46
|
+
> **Verdity** — from *verdict* + *fidelity/integrity*. Every finding is a **verdict** (structured, evidence-backed, confidence-scored), delivered with **integrity** (calibrated, gated, auditable, never auto-posted without earning it).
|
|
47
|
+
|
|
48
|
+
## ⚠️ Security Notice
|
|
49
|
+
|
|
50
|
+
This system handles **source code, secrets, and security findings**. See [SECURITY.md](SECURITY.md) for the full threat model and hardening guide. Key controls:
|
|
51
|
+
|
|
52
|
+
- **HMAC-SHA256** verified over raw body with constant-time comparison — no bypass, ever.
|
|
53
|
+
- **Dual-secret rotation** support with grace period.
|
|
54
|
+
- **Delivery-ID replay cache** with 24h TTL eviction.
|
|
55
|
+
- **All secrets** from environment / KMS — never committed.
|
|
56
|
+
- **Append-only audit log** with SHA-256 integrity checksums.
|
|
57
|
+
- **Schema-validated output** — agents cannot inject arbitrary commands; findings are structured data, not executable instructions.
|
|
58
|
+
|
|
59
|
+
## Table of Contents
|
|
60
|
+
|
|
61
|
+
- [Architecture](#architecture)
|
|
62
|
+
- [Non-Negotiable Constraints](#non-negotiable-constraints)
|
|
63
|
+
- [Project Structure](#project-structure)
|
|
64
|
+
- [Quick Start](#quick-start)
|
|
65
|
+
- [Security](#security)
|
|
66
|
+
- [Testing](#testing)
|
|
67
|
+
- [Configuration](#configuration)
|
|
68
|
+
- [Build Phases](#build-phases)
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Architecture
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
[GitHub] ──(HTTPS)──▶ [Ingestion Gateway] ──▶ [Event Queue] ──▶ [Orchestrator]
|
|
76
|
+
│ │
|
|
77
|
+
│ ┌───────┴───────┐
|
|
78
|
+
│ ▼ ▼
|
|
79
|
+
│ [Semantic Index] [Specialists]
|
|
80
|
+
│ │ (parallel)
|
|
81
|
+
│ │ │
|
|
82
|
+
│ ▼ ▼
|
|
83
|
+
│ [Aggregator] [Coding Agent]
|
|
84
|
+
│ │ │
|
|
85
|
+
│ ▼ ▼
|
|
86
|
+
│ [Router] [Verification Gate]
|
|
87
|
+
│ │ │
|
|
88
|
+
│ ▼ ▼
|
|
89
|
+
│ [Approval Queue] [Regression Runner]
|
|
90
|
+
│ │
|
|
91
|
+
└───────────────┼──▶ [Audit Store]
|
|
92
|
+
▼
|
|
93
|
+
[Token Economics]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Components
|
|
97
|
+
|
|
98
|
+
| Component | File | Responsibility |
|
|
99
|
+
|-----------|------|----------------|
|
|
100
|
+
| **Ingestion Gateway** | `gateway/app.py` | HMAC verify → enqueue → audit. Stateless, <1s response. |
|
|
101
|
+
| **Event Queue** | `event_queue.py` | Durable at-least-once queue, partitioned by repo. |
|
|
102
|
+
| **Orchestrator** | `orchestrator.py` | Durable workflow: fan-out specialists in parallel, fan-in results. |
|
|
103
|
+
| **Semantic Index** | `semantic_index.py` | Shared embeddings + symbol graph + incremental re-indexing. |
|
|
104
|
+
| **Security Agent** | `agents/security.py` | 3-pass scan: secrets, semantic search, diff vulnerabilities. |
|
|
105
|
+
| **Code Quality Agent** | `agents/code_quality.py` | Style/maintainability pattern detection. |
|
|
106
|
+
| **Testing Agent** | `agents/testing.py` | Test coverage gap detection. |
|
|
107
|
+
| **Documentation Agent** | `agents/documentation.py` | Docstring/CHANGELOG/breaking-change detection. |
|
|
108
|
+
| **Aggregator** | `aggregator.py` | Dedup, conflict resolution, ranking (deterministic). |
|
|
109
|
+
| **Router** | `router.py` | Multi-signal confidence scoring → route (auto-approve / manual-review / dismiss). |
|
|
110
|
+
| **Approval Queue** | `approval_queue.py` | Persistent store for sub-threshold findings awaiting human review. |
|
|
111
|
+
| **Coding Agent** | `coding_agent.py` | Rule-based fix generation for security/quality findings. |
|
|
112
|
+
| **Verification Gate** | `verification_gate.py` | Gate checks: compiles → lint → no-new-secrets → independent verifier. |
|
|
113
|
+
| **Token Economics** | `token_economics.py` | Per-call metering, budget caps, degradation signals. |
|
|
114
|
+
| **Budget Enforcer** | `budget_enforcer.py` | Real-time spend monitoring; drops optional specialists before security. |
|
|
115
|
+
| **HMAC Verify** | `hmac_verify.py` | Constant-time signature verification with dual-secret rotation. |
|
|
116
|
+
| **Webhook Normalizer** | `webhook_normalizer.py` | GitHub event → `VerdityEvent` schema. |
|
|
117
|
+
| **Audit Store** | `audit_store.py` | Append-only log with SHA-256 integrity checksums per record. |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Non-Negotiable Constraints
|
|
122
|
+
|
|
123
|
+
Violating any of these is a **build failure**, not a style choice.
|
|
124
|
+
|
|
125
|
+
| # | Constraint | Verification |
|
|
126
|
+
|---|-----------|-------------|
|
|
127
|
+
| 1 | Every webhook HMAC-SHA256 verified with constant-time comparison before parsing | `hmac_verify.py`, gateway tests |
|
|
128
|
+
| 2 | Ingestion decoupled from processing via durable queue | Gateway only calls `queue.publish()` |
|
|
129
|
+
| 3 | Specialists run in parallel; one timeout/failure never blocks others | `asyncio.gather`, timeout isolation tests |
|
|
130
|
+
| 4 | One shared semantic index — no private stores per agent | All agents receive injected `SemanticIndex` |
|
|
131
|
+
| 5 | Confidence scores computed by deterministic code, never LLM self-report | `_compute_secret_confidence()`, router tests |
|
|
132
|
+
| 6 | Code changes pass: gate → independent verifier → regression, in order | `VerificationGate`, `VerifierSubagent` are separate classes |
|
|
133
|
+
| 7 | Sub-threshold findings never auto-post; always go to Approval Queue | Router routes by score threshold |
|
|
134
|
+
| 8 | Every model call metered through `TokenEconomicsService` | All agents call `record_call()` |
|
|
135
|
+
| 9 | Every finding and approval decision logged to Audit Store | All agents append to `AuditStore` |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Project Structure
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
verdity/
|
|
143
|
+
├── src/verdity/
|
|
144
|
+
│ ├── __init__.py # Package root, version 0.1.0
|
|
145
|
+
│ ├── config.py # pydantic-settings; all secrets from env/KMS
|
|
146
|
+
│ ├── async_sqlite.py # stdlib sqlite3 wrapped with asyncio
|
|
147
|
+
│ ├── schemas/
|
|
148
|
+
│ │ ├── __init__.py # Re-exports (Severity, Finding, etc.)
|
|
149
|
+
│ │ └── _models.py # All Pydantic data models
|
|
150
|
+
│ ├── hmac_verify.py # HMAC-SHA256 + dual-secret rotation
|
|
151
|
+
│ ├── webhook_normalizer.py # GitHub event → TriggerType
|
|
152
|
+
│ ├── event_queue.py # SQLite-backed durable queue
|
|
153
|
+
│ ├── audit_store.py # Append-only audit log with sha256 checksums
|
|
154
|
+
│ ├── token_economics.py # Per-call metering + budget enforcement
|
|
155
|
+
│ ├── semantic_index.py # Shared embeddings + symbol graph + incremental indexing
|
|
156
|
+
│ ├── orchestrator.py # Durable workflow with scatter-gather fan-out
|
|
157
|
+
│ ├── aggregator.py # Dedup, conflict resolution, ranking
|
|
158
|
+
│ ├── router.py # Confidence scoring + routing decisions
|
|
159
|
+
│ ├── approval_queue.py # Persistent approval queue store
|
|
160
|
+
│ ├── coding_agent.py # Deterministic fix generation
|
|
161
|
+
│ ├── verification_gate.py # Gate checks + independent verifier + regression
|
|
162
|
+
│ ├── budget_enforcer.py # Spend monitoring + degradation signals
|
|
163
|
+
│ ├── agents/
|
|
164
|
+
│ │ ├── __init__.py
|
|
165
|
+
│ │ ├── security.py # Security specialist (3-pass scan)
|
|
166
|
+
│ │ ├── code_quality.py # Code quality specialist
|
|
167
|
+
│ │ ├── testing.py # Testing specialist
|
|
168
|
+
│ │ └── documentation.py # Documentation specialist
|
|
169
|
+
│ └── gateway/
|
|
170
|
+
│ └── app.py # FastAPI ingestion gateway
|
|
171
|
+
├── tests/
|
|
172
|
+
│ ├── conftest.py # Shared fixtures (temp DB dirs)
|
|
173
|
+
│ ├── test_hmac_verify.py # 11 tests
|
|
174
|
+
│ ├── test_webhook_normalizer.py # 5 tests
|
|
175
|
+
│ ├── test_event_queue.py # 7 tests
|
|
176
|
+
│ ├── test_audit_store.py # 4 tests
|
|
177
|
+
│ ├── test_token_economics.py # 7 tests
|
|
178
|
+
│ ├── test_semantic_index.py # 7 tests
|
|
179
|
+
│ ├── test_gateway.py # 5 tests
|
|
180
|
+
│ ├── test_orchestrator.py # 16 tests
|
|
181
|
+
│ ├── test_phase4.py # 7 tests
|
|
182
|
+
│ ├── test_phase5.py # 11 tests
|
|
183
|
+
│ ├── test_phase6.py # 14 tests
|
|
184
|
+
│ ├── test_phase7.py # 5 tests
|
|
185
|
+
│ └── test_phase8.py # 13 tests (STRIDE checklist + e2e)
|
|
186
|
+
├── dev-notes/
|
|
187
|
+
│ ├── GOAL.md # Build charter (single source of truth)
|
|
188
|
+
│ ├── 01-Product-Requirements-Document.md
|
|
189
|
+
│ ├── 02-Technical-Architecture-Document.md
|
|
190
|
+
│ ├── 03-API-Webhook-Specification.md
|
|
191
|
+
│ ├── 04-Security-Threat-Model.md
|
|
192
|
+
│ ├── 05-Agent-Orchestration-Design.md
|
|
193
|
+
│ ├── PHASE-0{1..8}-GATE.md # 8 gate validation documents
|
|
194
|
+
│ └── SECURITY-AUDIT.md # This phase's security audit findings
|
|
195
|
+
├── .env.example # Template — NEVER commit real secrets
|
|
196
|
+
├── .gitignore # Excludes .env, *.db, __pycache__, .htmlcov
|
|
197
|
+
├── pyproject.toml # Project config, pytest settings
|
|
198
|
+
└── README.md # This file
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Quick Start
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Create virtual environment
|
|
207
|
+
python -m venv .venv
|
|
208
|
+
source .venv/bin/activate # or .venv\Scripts\activate on Windows
|
|
209
|
+
|
|
210
|
+
# Install dependencies
|
|
211
|
+
pip install -e ".[dev]"
|
|
212
|
+
|
|
213
|
+
# Set required environment variables
|
|
214
|
+
cp .env.example .env
|
|
215
|
+
# Edit .env — NEVER commit the real file
|
|
216
|
+
|
|
217
|
+
# Run the full test suite (requires 100% coverage)
|
|
218
|
+
pytest -v
|
|
219
|
+
|
|
220
|
+
# Start the gateway (development)
|
|
221
|
+
uvicorn verdity.gateway.app:app --reload --port 8000
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Required Environment Variables
|
|
225
|
+
|
|
226
|
+
| Variable | Required | Description |
|
|
227
|
+
|----------|----------|-------------|
|
|
228
|
+
| `WEBHOOK_HMAC_SECRET` | ✅ | HMAC-SHA256 secret for GitHub webhook verification |
|
|
229
|
+
| `WEBHOOK_HMAC_SECRET_PREVIOUS` | ❌ | Previous secret during rotation (empty when not rotating) |
|
|
230
|
+
| `GITHUB_APP_ID` | ✅ | GitHub App numeric ID |
|
|
231
|
+
| `GITHUB_APP_INSTALLATION_ID` | ✅ | Installation ID for target repo |
|
|
232
|
+
| `GITHUB_APP_PRIVATE_KEY` | ✅ | PEM private key for the GitHub App |
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Security
|
|
237
|
+
|
|
238
|
+
See **[SECURITY.md](SECURITY.md)** for the full threat model, hardening guide, and STRIDE analysis.
|
|
239
|
+
|
|
240
|
+
### Security Controls Implemented
|
|
241
|
+
|
|
242
|
+
| Control | Implementation |
|
|
243
|
+
|---------|---------------|
|
|
244
|
+
| HMAC verification | `hmac.compare_digest` — constant-time, no bypass |
|
|
245
|
+
| Replay protection | Delivery-ID dedupe cache with 24h TTL eviction |
|
|
246
|
+
| Secret management | pydantic `SecretStr`; all secrets from env/KMS |
|
|
247
|
+
| Audit integrity | SHA-256 checksum per audit record |
|
|
248
|
+
| Output validation | All findings pass Pydantic schema validation |
|
|
249
|
+
| Tenant isolation | All stores partitioned by `repo_id` |
|
|
250
|
+
| Budget enforcement | Real-time spend monitoring with degrade signals |
|
|
251
|
+
| Independent verification | `VerifierSubagent` is separate from `CodingAgent` |
|
|
252
|
+
| Security headers | HSTS, CSP, X-Content-Type-Options on all responses |
|
|
253
|
+
| Path sanitization | Rejects traversal, absolute paths, null bytes |
|
|
254
|
+
|
|
255
|
+
### Reporting Security Issues
|
|
256
|
+
|
|
257
|
+
Please report security vulnerabilities via GitHub Security Advisory, not via public issues.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Testing
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Run all tests with coverage (fails if <100%)
|
|
265
|
+
pytest -v
|
|
266
|
+
|
|
267
|
+
# Run a single test file
|
|
268
|
+
pytest tests/test_hmac_verify.py -v
|
|
269
|
+
|
|
270
|
+
# Run with coverage report
|
|
271
|
+
pytest --cov=src/verdity --cov-report=html
|
|
272
|
+
open htmlcov/index.html
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Test Coverage
|
|
276
|
+
|
|
277
|
+
**100% coverage enforced** across all 236 tests in 15 test files.
|
|
278
|
+
|
|
279
|
+
| Module | Coverage |
|
|
280
|
+
|--------|----------|
|
|
281
|
+
| All modules | 100% |
|
|
282
|
+
| Total statements | 1,441 / 1,441 |
|
|
283
|
+
| Tests | 236 passing |
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Configuration
|
|
288
|
+
|
|
289
|
+
All configuration is via environment variables (see `.env.example`). In production, secrets should be injected from a managed secret store (AWS Secrets Manager, Azure Key Vault, HashiCorp Vault) — never from `.env` files.
|
|
290
|
+
|
|
291
|
+
### Database Paths
|
|
292
|
+
|
|
293
|
+
All SQLite databases default to `:memory:` for tests. For persistent storage:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
QUEUE_SQLITE_PATH=/var/lib/verdity/queue.db
|
|
297
|
+
AUDIT_SQLITE_PATH=/var/lib/verdity/audit.db
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Test databases are automatically created in a temp directory and cleaned up after each test run.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Build Phases
|
|
305
|
+
|
|
306
|
+
| Phase | Component | Status |
|
|
307
|
+
|-------|-----------|--------|
|
|
308
|
+
| 1 | Ingestion Gateway, Event Queue, Schemas, Audit Store, Token Economics | ✅ Complete |
|
|
309
|
+
| 2 | Semantic Index (embeddings + symbol graph + incremental re-indexing) | ✅ Complete |
|
|
310
|
+
| 3 | Orchestrator + Security Specialist Agent | ✅ Complete |
|
|
311
|
+
| 4 | Code Quality, Testing, Documentation Agents + Aggregator | ✅ Complete |
|
|
312
|
+
| 5 | Confidence Router + Approval Queue | ✅ Complete |
|
|
313
|
+
| 6 | Coding Agent + Verification Gate + Independent Verifier | ✅ Complete |
|
|
314
|
+
| 7 | Budget Enforcer + Degradation Signals | ✅ Complete |
|
|
315
|
+
| 8 | Hardening + STRIDE Threat Model Validation | ✅ Complete |
|
|
316
|
+
|
|
317
|
+
**Total: 236 tests passing, 100% coverage enforced.**
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Distribution
|
|
322
|
+
|
|
323
|
+
### Install from PyPI
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
pip install verdity
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Build from source
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
git clone https://github.com/Dream-Pixels-Forge/verdity.git
|
|
333
|
+
cd verdity
|
|
334
|
+
python -m venv .venv
|
|
335
|
+
source .venv/bin/activate
|
|
336
|
+
pip install -e ".[dev]"
|
|
337
|
+
pytest -v
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Publish to PyPI
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
# Build distribution packages
|
|
344
|
+
python -m build
|
|
345
|
+
|
|
346
|
+
# Upload to TestPyPI first (recommended)
|
|
347
|
+
python -m twine upload --repository testpypi dist/*
|
|
348
|
+
|
|
349
|
+
# Upload to PyPI
|
|
350
|
+
python -m twine upload dist/*
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
See [`.pypirc.example`](.pypirc.example) for Twine configuration.
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## License
|
|
358
|
+
|
|
359
|
+
MIT License — see [LICENSE](LICENSE).
|