From 161d779b7cb09b413cefc20729f967b053f9d5d0 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Wed, 7 Oct 2026 06:33:59 +0200 Subject: [PATCH] Complete STRA-8 comment carrier audit --- control-plane/src/kar_overlay.rs | 2 +- control-plane/src/kar_writer.rs | 4 +++- control-plane/src/prepare_preview.rs | 6 +----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/control-plane/src/kar_overlay.rs b/control-plane/src/kar_overlay.rs index 8223592a..984b3b0f 100644 --- a/control-plane/src/kar_overlay.rs +++ b/control-plane/src/kar_overlay.rs @@ -1442,7 +1442,7 @@ fn overlay_summary( } #[cfg(test)] -#[allow(clippy::items_after_test_module)] // comparison helpers remain grouped after this focused test module +#[allow(clippy::items_after_test_module)] mod tests { use super::*; use std::sync::atomic::{AtomicU64, Ordering}; diff --git a/control-plane/src/kar_writer.rs b/control-plane/src/kar_writer.rs index 06329803..d4e94b33 100644 --- a/control-plane/src/kar_writer.rs +++ b/control-plane/src/kar_writer.rs @@ -21,6 +21,8 @@ use crate::kar; #[cfg(test)] static ARCHIVE_TEMP_SEQUENCE: AtomicU64 = AtomicU64::new(0); const ARCHIVE_TEMP_SLOTS: u8 = 8; +#[cfg(unix)] +const POSIX_STICKY_BIT: u32 = 0o1000; #[cfg(test)] thread_local! { @@ -306,7 +308,7 @@ fn validate_private_archive_parent_with( return Err("KAR parent is not owned by the service or root".into()); } let mode = metadata.mode(); - let sticky = mode & 0o1000 != 0; // POSIX S_ISVTX is mode bit 01000. + let sticky = mode & POSIX_STICKY_BIT != 0; if mode & 0o022 != 0 && !sticky { return Err("KAR parent allows untrusted path replacement".into()); } diff --git a/control-plane/src/prepare_preview.rs b/control-plane/src/prepare_preview.rs index 407a26bd..3420db01 100644 --- a/control-plane/src/prepare_preview.rs +++ b/control-plane/src/prepare_preview.rs @@ -964,10 +964,6 @@ fn require_streamed_space( if archive_tensor_count == 0 || archive_tensor_count > 100_000 { return Err("streamed sharded tensor count exceeds KAR-2 limits".into()); } - // Every nested part stores at least `levels` four-byte plane words per - // 32 values; a RAW fallback stores four bytes per value. The smaller of - // these is a safe lower bound before section files are created. Passing - // this gate does not guarantee enough space for scales and metadata. let minimum_payload_bytes = archive_parts .iter() .flat_map(|parts| parts.iter()) @@ -3804,7 +3800,7 @@ mod tests { } #[test] - fn kar_payload_preflight_rejects_too_small_volumes_conservatively() { + fn minimum_payload_uses_plane_bytes_or_raw_fallback() { assert_eq!( minimum_part_payload_bytes(707_775_598_080, 2).unwrap(), 44_235_974_880