Reference implementation for the Phoenix Architecture. Work in progress.
aicoding.leaflet.pub/
ai
coding
crazy
1# Phase D — Evidence, Policy & Cascading Failure
2
3## Overview
4
5Phase D enforces risk-tiered evidence requirements for each IU and propagates
6failures through the dependency graph. When evidence fails for an IU, its
7dependents are re-validated.
8
9## Components
10
11### 1. Evidence Model (`src/models/evidence.ts`)
12
13```typescript
14enum EvidenceKind { TYPECHECK, LINT, BOUNDARY, UNIT_TEST, PROPERTY_TEST, STATIC_ANALYSIS, THREAT_NOTE, HUMAN_SIGNOFF }
15enum EvidenceStatus { PASS, FAIL, PENDING, SKIPPED }
16
17interface EvidenceRecord {
18 evidence_id: string;
19 kind: EvidenceKind;
20 status: EvidenceStatus;
21 iu_id: string;
22 canon_ids: string[];
23 artifact_hash?: string;
24 message?: string;
25 timestamp: string;
26}
27```
28
29### 2. Policy Engine (`src/policy-engine.ts`)
30
31Evaluates whether an IU has sufficient evidence for its risk tier.
32
33### 3. Cascade Engine (`src/cascade.ts`)
34
35When IU-X fails, propagates to dependents:
36- Dependent IU-Y: re-run typecheck, boundary, relevant tests
37- Failure propagation is explicit and graph-based
38
39### 4. Evidence Store (`src/store/evidence-store.ts`)
40
41Persists evidence records bound to IU IDs and canonical nodes.