#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ConditionalEventKind {
Ifdef,
Ifndef,
If,
Elif,
Else,
Endif,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ConditionalEventResidency {
GpuResidentDirective,
GpuResidentTruth,
HostLiveMacroTable,
HostStackThreading,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ConditionalEvent {
pub file: std::path::PathBuf,
pub kind: ConditionalEventKind,
pub directive_row: u32,
pub directive_byte_offset: u32,
pub depth_before: u32,
pub depth_after: u32,
pub parent_active: bool,
pub truth: Option<bool>,
pub current_active: bool,
pub branch_taken: bool,
pub directive_residency: ConditionalEventResidency,
pub state_residency: ConditionalEventResidency,
}
#[allow(clippy::too_many_arguments)]
pub(super) fn push_conditional_event(
events: &mut Vec<ConditionalEvent>,
file_path: &std::path::Path,
kind: ConditionalEventKind,
directive_row: usize,
directive_byte_offset: usize,
depth_before: usize,
depth_after: usize,
parent_active: bool,
truth: Option<bool>,
current_active: bool,
branch_taken: bool,
state_residency: ConditionalEventResidency,
) -> Result<(), String> {
events.push(ConditionalEvent {
file: file_path.to_path_buf(),
kind,
directive_row: u32::try_from(directive_row).map_err(|_| {
"vyre-libs::gpu_pipeline: conditional directive row exceeds u32. Fix: shard preprocessing before conditional-event evidence export.".to_string()
})?,
directive_byte_offset: u32::try_from(directive_byte_offset).map_err(|_| {
"vyre-libs::gpu_pipeline: conditional directive byte offset exceeds u32. Fix: shard preprocessing before conditional-event evidence export.".to_string()
})?,
depth_before: u32::try_from(depth_before).map_err(|_| {
"vyre-libs::gpu_pipeline: conditional depth exceeds u32. Fix: reject pathological conditional nesting before evidence export.".to_string()
})?,
depth_after: u32::try_from(depth_after).map_err(|_| {
"vyre-libs::gpu_pipeline: conditional depth exceeds u32. Fix: reject pathological conditional nesting before evidence export.".to_string()
})?,
parent_active,
truth,
current_active,
branch_taken,
directive_residency: ConditionalEventResidency::GpuResidentDirective,
state_residency,
});
Ok(())
}