From c8501da9d858229330de5b0d4ad41b2d459cdabb Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Thu, 5 Nov 2026 10:31:38 +0100 Subject: [PATCH] deploy: the low-RAM fallback keeps kar_source none (no archive to map) Co-Authored-By: Claude Sonnet 5.5 --- crates/deploy/src/resources.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/deploy/src/resources.rs b/crates/deploy/src/resources.rs index d7ab3981..afc20c02 100644 --- a/crates/deploy/src/resources.rs +++ b/crates/deploy/src/resources.rs @@ -342,8 +342,11 @@ pub fn apply( profile.memory.hard_floor_mib = raised(profile.memory.hard_floor_mib, hard); } if let Some(resident) = plan.mapped_resident_gib { - profile.kar_source = KarSource::File; - profile.memfd_extents = crate::profile::MemfdExtents::Full; + // `kar_source: none` has no archive to map: it stays none (the PLE table is read from the shard either way) + if profile.kar_source != KarSource::None { + profile.kar_source = KarSource::File; + profile.memfd_extents = crate::profile::MemfdExtents::Full; + } profile.expert_source = ExpertSource::Mapped; profile.memory.resident_budget_gib.get_or_insert(resident); profile.memory.lock = Some("off".into()); @@ -825,6 +828,22 @@ mod tests { profile.validate().unwrap(); } + #[test] + fn the_low_ram_fallback_keeps_a_profile_without_an_archive_without_one() { + let plan = compute( + &host(32, 121, 70), + Some(&gpu(32607, 32100)), + &Profile::builtin("rtx5090-32g-gguf-ple").unwrap(), + Preset::Workstation, + ); + assert!(plan.mapped_resident_gib.is_some(), "{plan:?}"); + let mut profile = Profile::builtin("rtx5090-32g-gguf-ple").unwrap(); + apply(&plan, &mut profile, &mut BTreeMap::new(), false); + assert_eq!(profile.kar_source, KarSource::None); + assert_eq!(profile.expert_source, ExpertSource::Mapped); + profile.validate().unwrap(); + } + #[test] fn a_small_host_gets_zero_resident_experts_and_dedicated_switches_too() { let plan = compute(