ifc_lite_geometry/construction/
reports.rs

1// SPDX-License-Identifier: MPL-2.0
2//! Owned execution evidence, including refusal and numerical-error paths.
3use crate::{BoolFailure, Error};
4use ifc_lite_core::IfcType;
5
6/// Reports carried across compilation, thread transfer and evaluation.
7#[derive(Debug, Clone, Default, PartialEq, Eq)]
8pub struct ConstructionReports {
9    pub curve_capped: bool,
10    /// Once per face type within this capture scope, matching router TLS policy.
11    /// Evaluated batches list execution reports before remaining source-only
12    /// reports. Eager admission and numerical execution have separate chronology;
13    /// this is not an occurrence-attributed canonical product event stream.
14    pub face_refused: Vec<IfcType>,
15    /// Cumulative decoder-known refusals at compilation completion. This can
16    /// include earlier reads through that decoder; it is not per-root attribution.
17    pub decoder_refused_record_ids: Vec<u32>,
18}
19
20impl ConstructionReports {
21    pub(crate) fn merge(&mut self, other: Self) {
22        self.curve_capped |= other.curve_capped;
23        for ty in other.face_refused {
24            if !self.face_refused.contains(&ty) { self.face_refused.push(ty); }
25        }
26        self.decoder_refused_record_ids.extend(other.decoder_refused_record_ids);
27        self.decoder_refused_record_ids.sort_unstable();
28        self.decoder_refused_record_ids.dedup();
29    }
30}
31
32/// A fresh boolean failure emitted by an executed instruction. Reused result
33/// edges can repeat semantic losses in successful root diagnostics separately.
34#[derive(Debug, Clone, PartialEq, Eq)]
35pub struct ConstructionDiagnostic {
36    pub source_id: u32,
37    pub failure: BoolFailure,
38}
39
40/// A failed batch carries evidence and no partial geometry success.
41#[derive(Debug, thiserror::Error)]
42#[error("Construction execution failed at root {root_source_id:?}, item {failed_source_id:?}: {error}")]
43pub struct ConstructionExecutionError {
44    pub root_source_id: Option<u32>,
45    pub failed_source_id: Option<u32>,
46    #[source]
47    pub error: Box<Error>,
48    /// Fresh failures from instructions actually executed before refusal/error.
49    pub diagnostics: Vec<ConstructionDiagnostic>,
50    pub reports: ConstructionReports,
51}