Skip to main content

allow_report/artifacts/
diff.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub struct DiffPostureSummary {
3    pub current_failures: usize,
4    pub new_findings: usize,
5    pub removed_findings: usize,
6    pub policy_failures: usize,
7    pub policy_review_items: usize,
8    pub policy_improvements: usize,
9}
10
11#[derive(Debug, Clone, Copy)]
12pub struct DiffFindingChange<'a> {
13    pub change: &'a str,
14    pub key: &'a str,
15    pub kind: &'a str,
16    pub family: Option<&'a str>,
17    pub path: &'a str,
18}
19
20#[derive(Debug, Clone, Copy)]
21pub struct DiffPolicyChange<'a> {
22    pub severity: &'a str,
23    pub allow_id: &'a str,
24    pub kind: &'a str,
25    pub message: &'a str,
26    pub exception_identity: Option<DiffExceptionIdentityChange<'a>>,
27    pub selector_identity: Option<DiffSelectorIdentityChange<'a>>,
28    pub selector_precision: Option<DiffSelectorPrecisionChange<'a>>,
29    pub scope: Option<DiffScopeChange<'a>>,
30    pub occurrence_limit: Option<DiffOccurrenceLimitChange>,
31    pub lifecycle: Option<DiffLifecycleChange<'a>>,
32    pub evidence: Option<DiffEvidenceChange<'a>>,
33    pub metadata: Option<DiffMetadataChange<'a>>,
34    pub requirement: Option<DiffRequirementChange<'a>>,
35    pub policy_status: Option<DiffPolicyStatusChange<'a>>,
36}
37
38#[derive(Debug, Clone, Copy)]
39pub struct DiffExceptionIdentityChange<'a> {
40    pub field: &'a str,
41    pub before: Option<&'a str>,
42    pub after: Option<&'a str>,
43}
44
45#[derive(Debug, Clone, Copy)]
46pub struct DiffSelectorIdentityChange<'a> {
47    pub changed_fields: &'a [&'a str],
48}
49
50#[derive(Debug, Clone, Copy)]
51pub struct DiffSelectorPrecisionChange<'a> {
52    pub before: u32,
53    pub after: u32,
54    pub removed_fields: &'a [&'a str],
55    pub added_fields: &'a [&'a str],
56}
57
58#[derive(Debug, Clone, Copy)]
59pub struct DiffScopeChange<'a> {
60    pub field: &'a str,
61    pub before: Option<&'a str>,
62    pub after: Option<&'a str>,
63}
64
65#[derive(Debug, Clone, Copy)]
66pub struct DiffOccurrenceLimitChange {
67    pub before: Option<u32>,
68    pub after: Option<u32>,
69}
70
71#[derive(Debug, Clone, Copy)]
72pub struct DiffLifecycleChange<'a> {
73    pub field: &'a str,
74    pub before: Option<&'a str>,
75    pub after: Option<&'a str>,
76}
77
78#[derive(Debug, Clone, Copy)]
79pub struct DiffEvidenceChange<'a> {
80    pub field: &'a str,
81    pub removed: &'a [String],
82    pub added: &'a [String],
83}
84
85#[derive(Debug, Clone, Copy)]
86pub struct DiffMetadataChange<'a> {
87    pub field: &'a str,
88    pub before: Option<&'a str>,
89    pub after: Option<&'a str>,
90}
91
92#[derive(Debug, Clone, Copy)]
93pub struct DiffRequirementChange<'a> {
94    pub field: &'a str,
95    pub before: bool,
96    pub after: bool,
97}
98
99#[derive(Debug, Clone, Copy)]
100pub struct DiffPolicyStatusChange<'a> {
101    pub before: Option<&'a str>,
102    pub after: Option<&'a str>,
103}
104
105#[derive(Debug, Clone, Copy)]
106pub struct DiffReport<'a> {
107    pub net_posture: &'a str,
108    pub reviewer_action: &'a str,
109    pub summary: DiffPostureSummary,
110    pub finding_changes: &'a [DiffFindingChange<'a>],
111    pub policy_changes: &'a [DiffPolicyChange<'a>],
112}