// K2456-K2460: fault_matrix.physical_boundary — Süreç kesme güç kaybı ayrımı // Invariant: SIGKILL fiziksel güç testi değildir // Positive: Geçici VM kesinti korpusu // Counterexample: Host öldürme fiziksel PASS sayılır // Acceptance: Kanıt sınırı ve dış deney gereği görünür pub const FAULT_MATRIX_PHYSICAL_BOUNDARY_SCHEMA: &str = "turkos.os.fault_matrix.physical_boundary.v1"; pub const FAULT_MATRIX_PHYSICAL_BOUNDARY_INVARIANT: &str = "SIGKILL fiziksel güç testi değildir"; pub const FAULT_MATRIX_PHYSICAL_BOUNDARY_POSITIVE: &str = "Geçici VM kesinti korpusu"; pub const FAULT_MATRIX_PHYSICAL_BOUNDARY_COUNTEREXAMPLE: &str = "Host öldürme fiziksel PASS sayılır"; pub const FAULT_MATRIX_PHYSICAL_BOUNDARY_ACCEPTANCE: &str = "Kanıt sınırı ve dış deney gereği görünür"; pub const EXPECTED_TRANSIENT_VM_CUT_CASES: u32 = 4; pub const EXPECTED_VISIBLE_EXTERNAL_BOUNDARY_NOTES: u32 = 2; pub const EXPECTED_SEPARATE_PHYSICAL_POWER_GATES: u32 = 1; pub const EXPECTED_SIGKILL_COUNTED_AS_PHYSICAL_PASS: u32 = 0; #[repr(u8)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum FaultMatrixPhysicalBoundaryError { HostKillCountedAsPhysicalPowerPass = 1, SigkillConflatedWithPhysicalPowerCut = 2, HiddenEvidenceBoundaryOrExternalRequirement = 3, TransientVmCutCasesMismatch = 4, VisibleExternalBoundaryNotesMismatch = 5, SeparatePhysicalPowerGatesMismatch = 6, ZeroPhysicalBoundaryEpoch = 7, NonMonotonicPhysicalBoundaryEpoch = 8, ZeroPhysicalBoundaryCorpusDigest = 9, UnboundFaultMatrixPhysicalBoundaryDigest = 10, AlreadyCommitted = 11, } #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct FaultMatrixPhysicalBoundaryRequest { pub host_kill_counted_as_physical_power_pass: bool, pub sigkill_conflated_with_physical_power_cut: bool, pub evidence_boundary_and_external_need_visible: bool, pub transient_vm_cut_cases: u32, pub visible_external_boundary_notes: u32, pub separate_physical_power_gates: u32, pub physical_boundary_epoch: u64, pub previous_physical_boundary_epoch: u64, pub physical_boundary_corpus_digest: u64, pub physical_boundary_binding_digest: u64, } #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct FaultMatrixPhysicalBoundaryReceipt { pub transient_vm_cut_cases: u32, pub visible_external_boundary_notes: u32, pub separate_physical_power_gates: u32, pub sigkill_counted_as_physical_pass: u32, pub evidence_boundary_and_external_need_visible: bool, pub physical_boundary_epoch: u64, pub physical_boundary_corpus_digest: u64, pub receipt_digest: u64, } pub const fn compute_fault_matrix_physical_boundary_binding_digest( transient_vm_cut_cases: u32, visible_external_boundary_notes: u32, separate_physical_power_gates: u32, sigkill_counted_as_physical_pass: u32, physical_boundary_epoch: u64, physical_boundary_corpus_digest: u64, ) -> u64 { let mut h: u64 = 0xcbf2_9ce4_8422_2325; h = (h ^ 0x2460_464d_5048_5931).wrapping_mul(0x0000_0100_0000_01b3); h = (h ^ (transient_vm_cut_cases as u64)).wrapping_mul(0x0000_0100_0000_01b3); h = (h ^ (visible_external_boundary_notes as u64)).wrapping_mul(0x0000_0100_0000_01b3); h = (h ^ (separate_physical_power_gates as u64)).wrapping_mul(0x0000_0100_0000_01b3); h = (h ^ (sigkill_counted_as_physical_pass as u64)).wrapping_mul(0x0000_0100_0000_01b3); h = (h ^ physical_boundary_epoch).wrapping_mul(0x0000_0100_0000_01b3); h = (h ^ physical_boundary_corpus_digest).wrapping_mul(0x0000_0100_0000_01b3); h } pub struct FaultMatrixPhysicalBoundaryCoordinator { committed: bool, committed_total: u64, rejected_total: u64, physical_boundary_refusals: u64, boundary_accounting_refusals: u64, committed_receipt: Option, } impl FaultMatrixPhysicalBoundaryCoordinator { pub const fn new() -> Self { Self { committed: false, committed_total: 0, rejected_total: 0, physical_boundary_refusals: 0, boundary_accounting_refusals: 0, committed_receipt: None, } } pub fn is_committed(&self) -> bool { self.committed } pub fn committed_total(&self) -> u64 { self.committed_total } pub fn rejected_total(&self) -> u64 { self.rejected_total } pub fn physical_boundary_refusals(&self) -> u64 { self.physical_boundary_refusals } pub fn boundary_accounting_refusals(&self) -> u64 { self.boundary_accounting_refusals } pub fn committed_receipt(&self) -> Option { self.committed_receipt } pub fn commit_physical_power_boundary( &mut self, req: &FaultMatrixPhysicalBoundaryRequest, ) -> Result { if self.committed { self.rejected_total += 1; return Err(FaultMatrixPhysicalBoundaryError::AlreadyCommitted); } if req.host_kill_counted_as_physical_power_pass { self.rejected_total += 1; self.physical_boundary_refusals += 1; return Err(FaultMatrixPhysicalBoundaryError::HostKillCountedAsPhysicalPowerPass); } if req.sigkill_conflated_with_physical_power_cut { self.rejected_total += 1; self.physical_boundary_refusals += 1; return Err(FaultMatrixPhysicalBoundaryError::SigkillConflatedWithPhysicalPowerCut); } if !req.evidence_boundary_and_external_need_visible { self.rejected_total += 1; self.physical_boundary_refusals += 1; return Err(FaultMatrixPhysicalBoundaryError::HiddenEvidenceBoundaryOrExternalRequirement); } if req.transient_vm_cut_cases != EXPECTED_TRANSIENT_VM_CUT_CASES { self.rejected_total += 1; self.boundary_accounting_refusals += 1; return Err(FaultMatrixPhysicalBoundaryError::TransientVmCutCasesMismatch); } if req.visible_external_boundary_notes != EXPECTED_VISIBLE_EXTERNAL_BOUNDARY_NOTES { self.rejected_total += 1; self.boundary_accounting_refusals += 1; return Err(FaultMatrixPhysicalBoundaryError::VisibleExternalBoundaryNotesMismatch); } if req.separate_physical_power_gates != EXPECTED_SEPARATE_PHYSICAL_POWER_GATES { self.rejected_total += 1; self.boundary_accounting_refusals += 1; return Err(FaultMatrixPhysicalBoundaryError::SeparatePhysicalPowerGatesMismatch); } if req.physical_boundary_epoch == 0 { self.rejected_total += 1; return Err(FaultMatrixPhysicalBoundaryError::ZeroPhysicalBoundaryEpoch); } if req.physical_boundary_epoch <= req.previous_physical_boundary_epoch { self.rejected_total += 1; return Err(FaultMatrixPhysicalBoundaryError::NonMonotonicPhysicalBoundaryEpoch); } if req.physical_boundary_corpus_digest == 0 { self.rejected_total += 1; return Err(FaultMatrixPhysicalBoundaryError::ZeroPhysicalBoundaryCorpusDigest); } let expected_binding = compute_fault_matrix_physical_boundary_binding_digest( req.transient_vm_cut_cases, req.visible_external_boundary_notes, req.separate_physical_power_gates, EXPECTED_SIGKILL_COUNTED_AS_PHYSICAL_PASS, req.physical_boundary_epoch, req.physical_boundary_corpus_digest, ); if req.physical_boundary_binding_digest != expected_binding { self.rejected_total += 1; self.boundary_accounting_refusals += 1; return Err(FaultMatrixPhysicalBoundaryError::UnboundFaultMatrixPhysicalBoundaryDigest); } self.committed = true; self.committed_total += 1; let receipt = FaultMatrixPhysicalBoundaryReceipt { transient_vm_cut_cases: req.transient_vm_cut_cases, visible_external_boundary_notes: req.visible_external_boundary_notes, separate_physical_power_gates: req.separate_physical_power_gates, sigkill_counted_as_physical_pass: EXPECTED_SIGKILL_COUNTED_AS_PHYSICAL_PASS, evidence_boundary_and_external_need_visible: true, physical_boundary_epoch: req.physical_boundary_epoch, physical_boundary_corpus_digest: req.physical_boundary_corpus_digest, receipt_digest: expected_binding ^ 0x2460_ACE0_5048_5931, }; self.committed_receipt = Some(receipt); Ok(receipt) } }