1use super::{
4 changes::{ChangeSet, Provenance},
5 graph::{ImpactPath, Reachability},
6 source::{SourceFinding, SourceItem},
7};
8use serde::Serialize;
9
10#[derive(Debug, Clone, Serialize)]
11pub struct DesignAssessment {
12 pub schema_version: u32,
13 pub provenance: Provenance,
14 pub coverage: Vec<String>,
15 pub changes: ChangeSet,
16 pub edges: Vec<EdgeEvidence>,
17 pub impact: Vec<ChangeImpact>,
18 pub exposures: Vec<InheritedExposure>,
19 pub abstractions: Vec<SourceFinding>,
20 pub shared_reasons: Vec<SharedReason>,
21 pub hierarchy: Vec<BoundarySummary>,
22 pub alternatives: Vec<Alternative>,
23 pub scenarios: Vec<ScenarioResult>,
24 pub priorities: Vec<Priority>,
25 pub external_interfaces: Vec<ExternalExposure>,
26 pub coordination: Vec<Coordination>,
27 pub lifecycle: Vec<LifecycleGroup>,
28 pub runtime: Vec<RuntimeRelation>,
29 pub decisions: Vec<DecisionReview>,
30 pub baseline: Option<BaselineSummary>,
31}
32
33#[derive(Debug, Clone, Serialize)]
34pub struct EdgeEvidence {
35 pub source: String,
36 pub target: String,
37 pub observed_usage: Option<String>,
38 pub inferred_strength: String,
39 pub origin: String,
40 pub reason: String,
41 pub file_path: Option<String>,
42 pub line: usize,
43 pub strength: f64,
44 pub distance: f64,
45 pub volatility: f64,
46 pub balance: f64,
47 pub unknowns: Vec<String>,
48}
49
50#[derive(Debug, Clone, Serialize)]
51pub struct ChangeImpact {
52 pub origin: String,
53 pub changed_items: Vec<String>,
54 pub reachability: Reachability,
55 pub tests: Vec<TestCandidate>,
56}
57
58#[derive(Debug, Clone, Serialize)]
59pub struct TestCandidate {
60 pub item: SourceItem,
61 pub reason: String,
62 pub path: Vec<String>,
63}
64
65#[derive(Debug, Clone, Serialize)]
66pub struct InheritedExposure {
67 pub module: String,
68 pub essential_volatility: Option<f64>,
69 pub observed_changes: Option<usize>,
70 pub upstream: String,
71 pub upstream_volatility: f64,
72 pub path: Vec<String>,
73 pub path_strength: f64,
75 pub basis: String,
76}
77
78#[derive(Debug, Clone, Serialize)]
79pub struct SharedReason {
80 pub id: String,
81 pub modules: Vec<String>,
82 pub origin: String,
83 pub reason: String,
84 pub co_changes: Option<usize>,
85 pub ratio: Option<f64>,
86 pub suggested_boundary: Option<String>,
87}
88
89#[derive(Debug, Clone, Serialize)]
90pub struct BoundarySummary {
91 pub level: String,
92 pub name: String,
93 pub members: Vec<String>,
94 pub internal_edges: usize,
95 pub incoming_edges: usize,
96 pub outgoing_edges: usize,
97 pub internal_groups: Vec<Vec<String>>,
98 pub observation: String,
99}
100
101#[derive(Debug, Clone, Serialize)]
102pub struct Alternative {
103 pub source: String,
104 pub target: String,
105 pub action: String,
106 pub current_balance: f64,
107 pub hypothetical_balance: f64,
108 pub assumptions: Vec<String>,
109 pub tradeoffs: Vec<String>,
110}
111
112#[derive(Debug, Clone, Serialize)]
113pub struct ScenarioResult {
114 pub name: String,
115 pub description: String,
116 pub affected_edges: usize,
117 pub current_balance: Option<f64>,
118 pub hypothetical_balance: Option<f64>,
119 pub assumptions: Vec<String>,
120}
121
122#[derive(Debug, Clone, Serialize)]
123pub struct Priority {
124 pub module: String,
125 pub reasons: Vec<String>,
126 pub affected_modules: usize,
127 pub issue_count: usize,
128 pub business_value: f64,
129 pub effort_days: Option<f64>,
130 pub planned_changes: Option<String>,
131 pub frozen_reason: Option<String>,
132 pub priority_score: f64,
134 pub value_per_effort: Option<f64>,
135}
136
137#[derive(Debug, Clone, Serialize)]
138pub struct ExternalExposure {
139 pub crate_name: String,
140 pub public_items: Vec<SourceItem>,
141 pub direct_modules: Vec<String>,
142 pub affected: Vec<ImpactPath>,
143 pub replacement_boundaries: Vec<String>,
144 pub unknowns: Vec<String>,
145}
146
147#[derive(Debug, Clone, Serialize)]
148pub struct Coordination {
149 pub source: String,
150 pub target: String,
151 pub source_owners: Vec<String>,
152 pub target_owners: Vec<String>,
153 pub cross_team: bool,
154 pub basis: String,
155}
156
157#[derive(Debug, Clone, Serialize)]
158pub struct LifecycleGroup {
159 pub kind: String,
160 pub unit: String,
161 pub modules: Vec<String>,
162 pub pairs_without_code_edges: usize,
163 pub origin: String,
164}
165
166#[derive(Debug, Clone, Serialize)]
167pub struct RuntimeRelation {
168 pub id: String,
169 pub source: String,
170 pub target: String,
171 pub kind: super::context::RelationshipKind,
172 pub origin: super::context::EvidenceOrigin,
173 pub evidence: String,
174 pub review: String,
175}
176
177#[derive(Debug, Clone, Serialize)]
178pub struct DecisionReview {
179 pub id: String,
180 pub modules: Vec<String>,
181 pub reason: String,
182 pub status: String,
183 pub triggered: Vec<String>,
184 pub pending_checks: Vec<String>,
185}
186
187#[derive(Debug, Clone, Serialize)]
188pub struct BaselineSummary {
189 pub reference: String,
190 pub reference_commit: Option<String>,
191 pub settings_fingerprint: Option<String>,
192 pub new_issues: usize,
193 pub worsened_issues: usize,
194 pub resolved_issues: usize,
195 pub score_delta: f64,
196 pub notes: Vec<String>,
197 pub findings: Vec<ComparedFinding>,
198}
199
200#[derive(Debug, Clone, Serialize)]
201pub struct ComparedFinding {
202 pub change: String,
203 pub source: String,
204 pub target: String,
205 pub issue_type: String,
206 pub severity: String,
207 pub description: String,
208 pub balance_score: f64,
209}