lib/closure/src/qualify/model.zig

daab053ee43316e1809a84551d573ddd1e5bf3d2

  1 const schema = @import("../schema/root.zig");
  2 
  3 pub const cells_max: usize = 64;
  4 pub const bounds_max: usize = 256;
  5 pub const seeds_max: usize = 256;
  6 pub const plan_bytes_max: usize = 256 * 1_024;
  7 pub const receipt_bytes_max: usize = 512 * 1_024;
  8 
  9 pub const Requirement = enum(u8) {
 10     required,
 11     excluded,
 12 };
 13 
 14 pub const CellKind = enum(u8) {
 15     correctness,
 16     slo,
 17 };
 18 
 19 pub const EvidenceKind = enum(u8) {
 20     proof,
 21     finite_exhaustive,
 22     simulation,
 23     qemu,
 24     hardware,
 25     assumption,
 26     measurement,
 27 };
 28 
 29 pub const BuildMode = enum(u8) {
 30     debug,
 31     release_safe,
 32     release_fast,
 33     release_small,
 34 };
 35 
 36 pub const CapacityCase = enum(u8) {
 37     none,
 38     at_capacity,
 39     over_capacity,
 40 };
 41 
 42 pub const ThresholdKind = enum(u8) {
 43     none,
 44     correctness,
 45     absolute_max,
 46     baseline_delta_max,
 47 };
 48 
 49 pub const Threshold = struct {
 50     kind: ThresholdKind,
 51     value: i64 = 0,
 52     confidence_ppm: u32 = 0,
 53 };
 54 
 55 pub const Bound = struct {
 56     name: schema.Name,
 57     value: u64,
 58 };
 59 
 60 pub const Cell = struct {
 61     id: schema.Name,
 62     owner: schema.Name,
 63     requirement: Requirement,
 64     kind: CellKind,
 65     evidence: EvidenceKind,
 66     workload: schema.Descriptor,
 67     phase: schema.Phase,
 68     scale: u64,
 69     build_mode: BuildMode,
 70     fault: schema.Descriptor,
 71     overload_counter: schema.Name,
 72     loss_counter: schema.Name,
 73     bound_start: u16,
 74     bound_count: u16,
 75     seed_start: u16,
 76     seed_count: u16,
 77     repetitions: u32,
 78     threshold: Threshold,
 79     capacity_case: CapacityCase,
 80     capacity: u64,
 81     work_max: u64,
 82     trace_steps_max: u64,
 83 };
 84 
 85 pub const Plan = struct {
 86     claim: schema.Descriptor,
 87     artifact_sha256: schema.Digest,
 88     execution_profile_sha256: schema.Digest,
 89     cells: []const Cell,
 90     bounds: []const Bound,
 91     seeds: []const u64,
 92 };
 93 
 94 pub const Capture = enum(u8) {
 95     complete,
 96     truncated,
 97     capacity_arithmetic_overflow,
 98     unsupported,
 99     insufficient_samples,
100     missing_threshold,
101     explorer_frontier_exhausted,
102     trace_capacity_exceeded,
103 };
104 
105 pub const Transition = enum(u8) {
106     none,
107     reject,
108     drop,
109     replace,
110     backpressure,
111 };
112 
113 pub const OutcomeCounts = struct {
114     offered: u64,
115     accepted: u64,
116     completed: u64,
117     rejected: u64,
118     dropped: u64,
119     outstanding: u64,
120 };
121 
122 pub const Statistics = struct {
123     present: bool = false,
124     interval_present: bool = false,
125     interleaved: bool = false,
126     baseline_profile_sha256: schema.Digest = schema.Digest.zero(),
127     candidate_profile_sha256: schema.Digest = schema.Digest.zero(),
128     sample_count: u32 = 0,
129     baseline_count: u32 = 0,
130     candidate_count: u32 = 0,
131     minimum: i64 = 0,
132     p50: i64 = 0,
133     p95: i64 = 0,
134     p99: i64 = 0,
135     maximum: i64 = 0,
136     interval_low: i64 = 0,
137     interval_high: i64 = 0,
138     baseline_high_water: u64 = 0,
139     candidate_high_water: u64 = 0,
140 };
141 
142 pub const Row = struct {
143     cell: schema.Name,
144     evidence: EvidenceKind,
145     verdict: schema.Verdict,
146     capture: Capture,
147     contract_pass: bool,
148     outcomes: OutcomeCounts,
149     before_digest: schema.Digest,
150     after_digest: schema.Digest,
151     effect_before_digest: schema.Digest,
152     effect_after_digest: schema.Digest,
153     high_water: u64,
154     work: u64,
155     allocation_count_after_seal: u64,
156     storage_address_before: usize,
157     storage_address_after: usize,
158     storage_capacity_before: u64,
159     storage_capacity_after: u64,
160     transition: Transition,
161     overload_count_before: u64,
162     overload_count_after: u64,
163     loss_count_before: u64,
164     loss_count_after: u64,
165     undeclared_effect_count: u64,
166     undeclared_state_change_count: u64,
167     statistics: Statistics,
168     evidence_path: schema.Descriptor,
169     trace_path: schema.Descriptor,
170 };
171 
172 pub const Frozen = struct {
173     plan: Plan,
174     sha256: schema.Digest,
175     bytes: []const u8,
176 };
177 
178 pub const Summary = struct {
179     verdict: schema.Verdict,
180     passed: u16,
181     refuted: u16,
182     inconclusive: u16,
183     not_exercised: u16,
184     work: u64,
185     high_water: u64,
186     allocation_count_after_seal: u64,
187 };