From e1a2571696cafd807ed42a7f3b659f39b434900d Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Wed, 21 Oct 2026 12:04:29 -0400 Subject: [PATCH] kernel-cases: SOLIDCRAFT_KERNEL=truck grades as the default kernel The kernel accepts `truck` (as well as unset) for its truck backend, and `boolean_kernel()` reports that backend as `default`. The rig compared the raw setting with that name, so a run with SOLIDCRAFT_KERNEL=truck reported every case as "this build runs booleans on the default kernel, not truck" instead of grading it. The rig now names unset, empty and `truck` alike as `default`. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt --- apps/solidcraft-cli/src/kernel_cases.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rs index 49d5f0e09..5c3ac8b71 100644 --- a/apps/solidcraft-cli/src/kernel_cases.rs +++ b/apps/solidcraft-cli/src/kernel_cases.rs @@ -11,7 +11,16 @@ use crate::{read_json, recipe}; /// The kernel this process runs on (`SOLIDCRAFT_KERNEL`, set by the caller). fn kernel() -> String { - std::env::var("SOLIDCRAFT_KERNEL").ok().filter(|k| !k.is_empty()).unwrap_or_else(|| "default".into()) + kernel_name(std::env::var("SOLIDCRAFT_KERNEL").ok().as_deref()) +} + +/// The rig's name for a `SOLIDCRAFT_KERNEL` setting: unset, empty or `truck` (all of which the +/// kernel runs as truck) is `default`, the name `boolean_kernel` reports for truck. +fn kernel_name(setting: Option<&str>) -> String { + match setting.map(str::trim) { + None | Some("") | Some("truck") => "default".into(), + Some(other) => other.into(), + } } /// How many cases a chain of `base` recipes may go through (a ladder case builds on the one @@ -371,6 +380,15 @@ mod tests { let _ = std::fs::remove_dir_all(&root); } + #[test] + fn truck_named_explicitly_is_the_default_kernel() { + // `SOLIDCRAFT_KERNEL=truck` runs truck, so the rig must not call it a build mismatch. + for setting in [None, Some(""), Some(" "), Some("truck")] { + assert_eq!(kernel_name(setting), "default"); + } + assert_eq!(kernel_name(Some("smlib")), "smlib"); + } + #[test] fn a_base_cycle_is_an_error_not_a_hang() { let root = std::env::temp_dir().join(format!("kernel-cases-cycle-{}", std::process::id()));