Skip to main content

omena_abstract_value/
types.rs

1use crate::{Lin01ProvenanceSemiringV0, NaturalCountProvenanceSemiringV0, ProvenanceSemiringV0};
2use omena_incremental::{IncrementalComputationPlanV0, IncrementalSnapshotV0};
3use serde::Serialize;
4
5pub const MAX_FINITE_CLASS_VALUES: usize = 8;
6pub const MAX_FLOW_ANALYSIS_ITERATIONS: usize = 32;
7
8#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
9#[serde(rename_all = "camelCase")]
10pub struct AbstractValueDomainSummaryV0 {
11    pub schema_version: &'static str,
12    pub product: &'static str,
13    pub domain_kinds: Vec<&'static str>,
14    pub max_finite_class_values: usize,
15    pub reduced_product_structure_ready: bool,
16    pub reduced_product_axes: Vec<&'static str>,
17    pub reduced_product_operations: Vec<&'static str>,
18    pub reduced_product_consumers: Vec<&'static str>,
19    pub selector_projection_certainties: Vec<&'static str>,
20    pub provenance_tree_ready: bool,
21    pub provenance_tree_scopes: Vec<&'static str>,
22    pub cascade_family_substrate_ready: bool,
23    pub cascade_family_framing: &'static str,
24    pub cascade_family_claim_level: &'static str,
25}
26
27#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
28#[serde(rename_all = "camelCase")]
29pub struct AbstractValueFlowAnalysisSummaryV0 {
30    pub schema_version: &'static str,
31    pub product: &'static str,
32    pub context_sensitivity: &'static str,
33    pub incremental_engine: &'static str,
34    pub analysis_scopes: Vec<&'static str>,
35    pub reuse_policy: &'static str,
36    pub transfer_kinds: Vec<&'static str>,
37    pub max_iterations: usize,
38}
39
40#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
41#[serde(rename_all = "camelCase")]
42pub struct ReducedClassValueDerivationV0 {
43    pub schema_version: &'static str,
44    pub product: &'static str,
45    pub input_fact_kind: String,
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub input_constraint_kind: Option<String>,
48    pub input_value_count: usize,
49    pub reduced_kind: &'static str,
50    pub steps: Vec<ReducedClassValueDerivationStepV0>,
51}
52
53#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
54#[serde(rename_all = "camelCase")]
55pub struct ReducedClassValueDerivationStepV0 {
56    pub operation: &'static str,
57    #[serde(skip_serializing_if = "Option::is_none")]
58    pub input_kind: Option<&'static str>,
59    #[serde(skip_serializing_if = "Option::is_none")]
60    pub refinement_kind: Option<&'static str>,
61    pub result_kind: &'static str,
62    #[serde(skip_serializing_if = "Option::is_none")]
63    pub result_provenance: Option<AbstractClassValueProvenanceV0>,
64    pub reason: &'static str,
65}
66
67#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
68#[serde(rename_all = "camelCase")]
69pub struct ReducedClassValueProductDomainV0 {
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub prefix: Option<String>,
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub suffix: Option<String>,
74    #[serde(skip_serializing_if = "Option::is_none")]
75    pub min_length: Option<usize>,
76    pub must_chars: String,
77    #[serde(skip_serializing_if = "Option::is_none")]
78    pub allowed_chars: Option<String>,
79}
80
81#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
82#[serde(rename_all = "camelCase")]
83pub struct ReducedClassValueProductV0 {
84    pub schema_version: &'static str,
85    pub product: &'static str,
86    pub source_value_kind: &'static str,
87    #[serde(skip_serializing_if = "Option::is_none")]
88    pub prefix: Option<ReducedClassValuePrefixAxisV0>,
89    #[serde(skip_serializing_if = "Option::is_none")]
90    pub suffix: Option<ReducedClassValueSuffixAxisV0>,
91    pub char_inclusion: ReducedClassValueCharInclusionAxisV0,
92    #[serde(skip_serializing_if = "Option::is_none")]
93    pub min_length: Option<usize>,
94    pub lower_bound_length: usize,
95}
96
97#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
98#[serde(rename_all = "camelCase")]
99pub struct ReducedClassValueProductIterationV0 {
100    pub schema_version: &'static str,
101    pub product: &'static str,
102    pub input_count: usize,
103    pub applied_constraint_count: usize,
104    pub iteration_count: usize,
105    pub converged: bool,
106    pub monotone_witness_valid: bool,
107    pub result_kind: &'static str,
108    pub result_value: AbstractClassValueV0,
109    #[serde(skip_serializing_if = "Option::is_none")]
110    pub final_product: Option<ReducedClassValueProductV0>,
111    pub steps: Vec<ReducedClassValueProductIterationStepV0>,
112}
113
114#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
115#[serde(rename_all = "camelCase")]
116pub struct ReducedClassValueProductIterationStepV0 {
117    pub iteration: usize,
118    pub operation: &'static str,
119    pub input_value_kind: &'static str,
120    pub result_kind: &'static str,
121    pub changed: bool,
122    pub monotone_with_previous: bool,
123    pub reason: &'static str,
124}
125
126#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
127#[serde(rename_all = "camelCase")]
128pub struct BeliefPropagationMessageV0 {
129    pub iteration: usize,
130    pub from_factor: &'static str,
131    pub to_variable: &'static str,
132    pub operation: &'static str,
133    pub result_kind: &'static str,
134    pub monotone_with_previous: bool,
135}
136
137#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
138#[serde(rename_all = "camelCase")]
139/// V0 algorithm-view substrate over the reduced-product class-value iterator.
140///
141/// This records compatibility evidence for the current message-passing view; it
142/// is not a belief-propagation paper result or mechanism-completeness claim.
143pub struct BeliefPropagationIterationV0 {
144    pub schema_version: &'static str,
145    pub product: &'static str,
146    pub algorithm_view: &'static str,
147    pub substrate: &'static str,
148    pub equation_system: &'static str,
149    pub input_count: usize,
150    pub message_count: usize,
151    pub iteration_count: usize,
152    pub converged: bool,
153    pub monotone_witness_valid: bool,
154    pub fixed_point_reached: bool,
155    pub messages: Vec<BeliefPropagationMessageV0>,
156    pub source_iteration: ReducedClassValueProductIterationV0,
157}
158
159#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
160#[serde(rename_all = "camelCase")]
161pub struct ReducedClassValuePrefixAxisV0 {
162    pub prefix: String,
163}
164
165#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
166#[serde(rename_all = "camelCase")]
167pub struct ReducedClassValueSuffixAxisV0 {
168    pub suffix: String,
169}
170
171#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
172#[serde(rename_all = "camelCase")]
173pub struct ReducedClassValueCharInclusionAxisV0 {
174    pub must_chars: String,
175    #[serde(skip_serializing_if = "Option::is_none")]
176    pub allowed_chars: Option<String>,
177    pub may_include_other_chars: bool,
178}
179
180#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
181#[serde(
182    tag = "kind",
183    rename_all = "camelCase",
184    rename_all_fields = "camelCase"
185)]
186pub enum AbstractClassValueV0 {
187    Bottom,
188    Exact {
189        value: String,
190    },
191    FiniteSet {
192        values: Vec<String>,
193    },
194    Prefix {
195        prefix: String,
196        #[serde(skip_serializing_if = "Option::is_none")]
197        provenance: Option<AbstractClassValueProvenanceV0>,
198    },
199    Suffix {
200        suffix: String,
201        #[serde(skip_serializing_if = "Option::is_none")]
202        provenance: Option<AbstractClassValueProvenanceV0>,
203    },
204    PrefixSuffix {
205        prefix: String,
206        suffix: String,
207        min_length: usize,
208        #[serde(skip_serializing_if = "Option::is_none")]
209        provenance: Option<AbstractClassValueProvenanceV0>,
210    },
211    CharInclusion {
212        must_chars: String,
213        may_chars: String,
214        #[serde(skip_serializing_if = "is_false")]
215        may_include_other_chars: bool,
216        #[serde(skip_serializing_if = "Option::is_none")]
217        provenance: Option<AbstractClassValueProvenanceV0>,
218    },
219    Composite {
220        #[serde(skip_serializing_if = "Option::is_none")]
221        prefix: Option<String>,
222        #[serde(skip_serializing_if = "Option::is_none")]
223        suffix: Option<String>,
224        #[serde(skip_serializing_if = "Option::is_none")]
225        min_length: Option<usize>,
226        must_chars: String,
227        may_chars: String,
228        #[serde(skip_serializing_if = "is_false")]
229        may_include_other_chars: bool,
230        #[serde(skip_serializing_if = "Option::is_none")]
231        provenance: Option<AbstractClassValueProvenanceV0>,
232    },
233    Top,
234}
235
236#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
237#[serde(
238    tag = "kind",
239    rename_all = "camelCase",
240    rename_all_fields = "camelCase"
241)]
242pub enum AbstractPropertyValueV0 {
243    Bottom {
244        property_name: String,
245    },
246    Exact {
247        property_name: String,
248        value: String,
249        #[serde(skip_serializing_if = "Option::is_none")]
250        pseudo_state: Option<String>,
251    },
252    FiniteSet {
253        property_name: String,
254        values: Vec<String>,
255        pseudo_states: Vec<String>,
256    },
257    CustomPropertyReference {
258        property_name: String,
259        custom_property_name: String,
260        #[serde(skip_serializing_if = "Option::is_none")]
261        pseudo_state: Option<String>,
262    },
263    Top {
264        property_name: String,
265    },
266}
267
268#[derive(Debug, Clone, PartialEq, Eq)]
269pub struct AbstractPropertyValueCandidateV0 {
270    pub property_name: String,
271    pub value: String,
272    pub pseudo_state: Option<String>,
273}
274
275#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
276#[serde(rename_all = "camelCase")]
277pub struct AbstractPropertyValueNarrowingV0 {
278    pub schema_version: &'static str,
279    pub product: &'static str,
280    pub stylesheet_scope: &'static str,
281    pub property_name: String,
282    #[serde(skip_serializing_if = "Option::is_none")]
283    pub requested_pseudo_state: Option<String>,
284    pub candidate_count: usize,
285    pub matched_candidate_count: usize,
286    pub value: AbstractPropertyValueV0,
287}
288
289#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
290#[serde(rename_all = "camelCase")]
291pub enum AbstractClassValueProvenanceV0 {
292    FiniteSetWideningChars,
293    FiniteSetWideningComposite,
294    PrefixJoinLcp,
295    SuffixJoinLcs,
296    PrefixSuffixJoin,
297    CompositeJoin,
298    CompositeConcat,
299}
300
301#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
302#[serde(rename_all = "camelCase")]
303pub struct LinearProvenanceTermV0 {
304    pub coefficient: u8,
305    pub label: &'static str,
306}
307
308#[derive(Debug, Clone, PartialEq, Eq)]
309pub struct LinearProvenancePathV0 {
310    pub labels: Vec<&'static str>,
311    pub support_count: u8,
312}
313
314impl LinearProvenancePathV0 {
315    pub fn supported(labels: &[&'static str], support_count: u8) -> Self {
316        Self {
317            labels: labels.to_vec(),
318            support_count,
319        }
320    }
321
322    pub fn unsupported(labels: &[&'static str]) -> Self {
323        Self {
324            labels: labels.to_vec(),
325            support_count: 0,
326        }
327    }
328}
329
330#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
331#[serde(rename_all = "camelCase")]
332#[serde(bound(serialize = "K: Serialize"))]
333/// V0 freeze-candidate provenance contract over the existing label vector.
334///
335/// The shape is a strict-superset bridge for staged query provenance evidence;
336/// it does not declare Cargo 1.0 API finality or a completed QTT/sheaf model.
337pub struct LinearProvenanceV0<K: ProvenanceSemiringV0> {
338    pub schema_version: &'static str,
339    pub product: &'static str,
340    pub layer_marker: &'static str,
341    pub feature_gate: &'static str,
342    pub semiring_identifier: &'static str,
343    pub semiring: K,
344    pub term_count: usize,
345    pub terms: Vec<LinearProvenanceTermV0>,
346}
347
348impl<K: ProvenanceSemiringV0> LinearProvenanceV0<K> {
349    pub fn semiring_identifier(&self) -> &'static str {
350        self.semiring_identifier
351    }
352
353    pub fn labels(&self) -> Vec<&'static str> {
354        self.terms.iter().map(|term| term.label).collect()
355    }
356}
357
358impl LinearProvenanceV0<Lin01ProvenanceSemiringV0> {
359    pub fn from_static_labels(labels: &[&'static str]) -> Self {
360        let terms = labels
361            .iter()
362            .map(|label| LinearProvenanceTermV0 {
363                coefficient: 1,
364                label,
365            })
366            .collect::<Vec<_>>();
367        linear_provenance_with_terms(Lin01ProvenanceSemiringV0::new(), terms)
368    }
369}
370
371impl LinearProvenanceV0<NaturalCountProvenanceSemiringV0> {
372    pub fn from_static_labels(labels: &[&'static str]) -> Self {
373        let path = LinearProvenancePathV0::supported(labels, 1);
374        Self::from_composed_paths(&[path])
375    }
376
377    pub fn from_composed_paths(paths: &[LinearProvenancePathV0]) -> Self {
378        let semiring = NaturalCountProvenanceSemiringV0::new();
379        let mut terms = Vec::<LinearProvenanceTermV0>::new();
380
381        for path in paths {
382            let support = u16::from(path.support_count);
383            let mut path_weight = semiring.multiply(&semiring.one(), &support);
384            for _ in &path.labels {
385                path_weight = semiring.multiply(&path_weight, &semiring.one());
386            }
387
388            for label in &path.labels {
389                if let Some(term) = terms.iter_mut().find(|term| term.label == *label) {
390                    let updated = semiring.add(&u16::from(term.coefficient), &path_weight);
391                    term.coefficient = u16_to_u8_saturating(updated);
392                } else {
393                    terms.push(LinearProvenanceTermV0 {
394                        coefficient: u16_to_u8_saturating(
395                            semiring.add(&semiring.zero(), &path_weight),
396                        ),
397                        label,
398                    });
399                }
400            }
401        }
402
403        linear_provenance_with_terms(semiring, terms)
404    }
405}
406
407fn linear_provenance_with_terms<K: ProvenanceSemiringV0>(
408    semiring: K,
409    terms: Vec<LinearProvenanceTermV0>,
410) -> LinearProvenanceV0<K> {
411    LinearProvenanceV0 {
412        schema_version: "0",
413        product: "omena-abstract-value.linear-provenance",
414        layer_marker: "qtt-graded",
415        feature_gate: "qtt-provenance",
416        semiring_identifier: K::IDENTIFIER,
417        semiring,
418        term_count: terms.len(),
419        terms,
420    }
421}
422
423fn u16_to_u8_saturating(value: u16) -> u8 {
424    value.min(u16::from(u8::MAX)) as u8
425}
426
427#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
428#[serde(rename_all = "camelCase")]
429pub struct AbstractClassValueProvenanceTreeV0 {
430    pub schema_version: &'static str,
431    pub product: &'static str,
432    pub value_kind: &'static str,
433    pub value: AbstractClassValueV0,
434    #[serde(skip_serializing_if = "Option::is_none")]
435    pub value_provenance: Option<AbstractClassValueProvenanceV0>,
436    pub root: AbstractClassValueProvenanceNodeV0,
437}
438
439#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
440#[serde(rename_all = "camelCase")]
441pub struct AbstractClassValueProvenanceNodeV0 {
442    pub operation: &'static str,
443    pub result_kind: &'static str,
444    #[serde(skip_serializing_if = "Option::is_none")]
445    pub result_provenance: Option<AbstractClassValueProvenanceV0>,
446    #[serde(skip_serializing_if = "Option::is_none")]
447    pub detail: Option<String>,
448    pub reason: &'static str,
449    pub children: Vec<AbstractClassValueProvenanceNodeV0>,
450}
451
452#[derive(Debug, Clone, PartialEq, Eq)]
453pub struct CompositeClassValueInputV0 {
454    pub prefix: Option<String>,
455    pub suffix: Option<String>,
456    pub min_length: Option<usize>,
457    pub must_chars: String,
458    pub may_chars: String,
459    pub may_include_other_chars: bool,
460    pub provenance: Option<AbstractClassValueProvenanceV0>,
461}
462
463#[derive(Debug, Clone, PartialEq, Eq)]
464pub struct ExternalStringTypeFactsV0 {
465    pub kind: String,
466    pub constraint_kind: Option<String>,
467    pub values: Option<Vec<String>>,
468    pub prefix: Option<String>,
469    pub suffix: Option<String>,
470    pub min_len: Option<usize>,
471    pub max_len: Option<usize>,
472    pub char_must: Option<String>,
473    pub char_may: Option<String>,
474    pub may_include_other_chars: Option<bool>,
475}
476
477#[derive(Debug, Clone, PartialEq, Eq)]
478pub struct ClassValueFlowGraphV0 {
479    pub context_key: Option<String>,
480    pub nodes: Vec<ClassValueFlowNodeV0>,
481}
482
483#[derive(Debug, Clone, PartialEq, Eq)]
484pub struct ClassValueControlFlowGraphV0 {
485    pub context_key: Option<String>,
486    pub entry_block_id: String,
487    pub blocks: Vec<ClassValueControlFlowBlockV0>,
488}
489
490#[derive(Debug, Clone, PartialEq, Eq)]
491pub struct ClassValueControlFlowBlockV0 {
492    pub id: String,
493    pub nodes: Vec<ClassValueFlowNodeV0>,
494    pub successor_block_ids: Vec<String>,
495}
496
497#[derive(Debug, Clone, PartialEq, Eq)]
498pub struct ClassValueFlowNodeV0 {
499    pub id: String,
500    pub predecessors: Vec<String>,
501    pub transfer: ClassValueFlowTransferV0,
502}
503
504#[derive(Debug, Clone, PartialEq, Eq)]
505pub enum ClassValueFlowTransferV0 {
506    AssignFacts(ExternalStringTypeFactsV0),
507    RefineFacts(ExternalStringTypeFactsV0),
508    ConcatFacts(ExternalStringTypeFactsV0),
509    Join,
510}
511
512#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
513#[serde(rename_all = "camelCase")]
514pub struct ClassValueFlowAnalysisV0 {
515    pub schema_version: &'static str,
516    pub product: &'static str,
517    pub context_sensitivity: &'static str,
518    #[serde(skip_serializing_if = "Option::is_none")]
519    pub context_key: Option<String>,
520    pub converged: bool,
521    pub iteration_count: usize,
522    pub nodes: Vec<ClassValueFlowNodeResultV0>,
523}
524
525#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
526#[serde(rename_all = "camelCase")]
527pub struct ClassValueFlowIncrementalAnalysisV0 {
528    pub schema_version: &'static str,
529    pub product: &'static str,
530    pub reused_previous_analysis: bool,
531    pub incremental_plan: IncrementalComputationPlanV0,
532    pub next_snapshot: IncrementalSnapshotV0,
533    pub analysis: ClassValueFlowAnalysisV0,
534}
535
536#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
537#[serde(rename_all = "camelCase")]
538pub struct ClassValueFlowIncrementalBatchAnalysisV0 {
539    pub schema_version: &'static str,
540    pub product: &'static str,
541    pub revision: u64,
542    pub context_count: usize,
543    pub dirty_context_count: usize,
544    pub reused_context_count: usize,
545    pub entries: Vec<ClassValueFlowIncrementalBatchEntryV0>,
546}
547
548#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
549#[serde(rename_all = "camelCase")]
550pub struct ClassValueFlowIncrementalBatchEntryV0 {
551    pub context_key: String,
552    pub analysis: ClassValueFlowIncrementalAnalysisV0,
553}
554
555#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
556#[serde(rename_all = "camelCase")]
557pub struct ClassValueControlFlowAnalysisV0 {
558    pub schema_version: &'static str,
559    pub product: &'static str,
560    pub context_sensitivity: &'static str,
561    #[serde(skip_serializing_if = "Option::is_none")]
562    pub context_key: Option<String>,
563    pub block_count: usize,
564    pub edge_count: usize,
565    pub reachable_block_count: usize,
566    pub unreachable_block_ids: Vec<String>,
567    pub branch_block_ids: Vec<String>,
568    pub join_block_ids: Vec<String>,
569    pub flow_analysis: ClassValueFlowAnalysisV0,
570    pub blocks: Vec<ClassValueControlFlowBlockResultV0>,
571}
572
573#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
574#[serde(rename_all = "camelCase")]
575pub struct ClassValueControlFlowBlockResultV0 {
576    pub block_id: String,
577    pub reachable: bool,
578    pub node_ids: Vec<String>,
579    pub successor_block_ids: Vec<String>,
580    pub exit_value_kind: &'static str,
581    pub exit_value: AbstractClassValueV0,
582}
583
584#[derive(Debug, Clone, PartialEq, Eq)]
585pub struct OneCfaCallSiteFlowInputV0 {
586    pub callee_key: String,
587    pub call_site_id: String,
588    pub graph: ClassValueFlowGraphV0,
589    pub exit_node_id: String,
590}
591
592#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
593#[serde(rename_all = "camelCase")]
594pub struct OneCfaCallSiteFlowAnalysisV0 {
595    pub schema_version: &'static str,
596    pub product: &'static str,
597    pub context_sensitivity: &'static str,
598    pub call_site_count: usize,
599    pub callee_count: usize,
600    pub entries: Vec<OneCfaCallSiteFlowEntryV0>,
601    pub callee_summaries: Vec<OneCfaCalleeFlowSummaryV0>,
602}
603
604#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
605#[serde(rename_all = "camelCase")]
606pub struct OneCfaCallSiteFlowEntryV0 {
607    pub callee_key: String,
608    pub call_site_id: String,
609    pub context_key: String,
610    pub exit_node_id: String,
611    pub exit_value_kind: &'static str,
612    pub exit_value: AbstractClassValueV0,
613    pub analysis: ClassValueFlowAnalysisV0,
614    pub derivation: OneCfaCallSiteDerivationV0,
615}
616
617#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
618#[serde(rename_all = "camelCase")]
619pub struct OneCfaCalleeFlowSummaryV0 {
620    pub callee_key: String,
621    pub call_site_count: usize,
622    pub joined_exit_value_kind: &'static str,
623    pub joined_exit_value: AbstractClassValueV0,
624}
625
626#[derive(Debug, Clone, PartialEq, Eq)]
627pub struct KLimitedCallSiteFlowInputV0 {
628    pub callee_key: String,
629    pub call_site_stack: Vec<String>,
630    pub graph: ClassValueFlowGraphV0,
631    pub exit_node_id: String,
632}
633
634#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
635#[serde(rename_all = "camelCase")]
636pub struct KLimitedCallSiteFlowAnalysisV0 {
637    pub schema_version: &'static str,
638    pub product: &'static str,
639    pub context_sensitivity: String,
640    pub max_context_depth: usize,
641    pub call_site_count: usize,
642    pub callee_count: usize,
643    pub entries: Vec<KLimitedCallSiteFlowEntryV0>,
644    pub callee_summaries: Vec<OneCfaCalleeFlowSummaryV0>,
645}
646
647#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
648#[serde(rename_all = "camelCase")]
649pub struct KLimitedCallSiteFlowEntryV0 {
650    pub callee_key: String,
651    pub call_site_stack: Vec<String>,
652    pub context_key: String,
653    pub exit_node_id: String,
654    pub exit_value_kind: &'static str,
655    pub exit_value: AbstractClassValueV0,
656    pub analysis: ClassValueFlowAnalysisV0,
657}
658
659#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
660#[serde(rename_all = "camelCase")]
661pub struct OneCfaCallSiteDerivationV0 {
662    pub schema_version: &'static str,
663    pub product: &'static str,
664    pub call_site_id: String,
665    pub context_key: String,
666    pub steps: Vec<OneCfaCallSiteDerivationStepV0>,
667}
668
669#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
670#[serde(rename_all = "camelCase")]
671pub struct OneCfaCallSiteDerivationStepV0 {
672    pub operation: &'static str,
673    pub result_kind: &'static str,
674    pub reason: &'static str,
675}
676
677#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
678#[serde(rename_all = "camelCase")]
679pub struct ClassValueFlowNodeResultV0 {
680    pub id: String,
681    pub predecessor_ids: Vec<String>,
682    pub transfer_kind: &'static str,
683    pub value_kind: &'static str,
684    pub value: AbstractClassValueV0,
685}
686
687#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
688#[serde(rename_all = "camelCase")]
689pub enum SelectorProjectionCertaintyV0 {
690    Exact,
691    Inferred,
692    Possible,
693}
694
695#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
696#[serde(rename_all = "camelCase")]
697pub struct AbstractSelectorProjectionV0 {
698    pub selector_names: Vec<String>,
699    pub certainty: SelectorProjectionCertaintyV0,
700}
701
702fn is_false(value: &bool) -> bool {
703    !value
704}