lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

commit 6b5512f76de02819b2db90ddc4f3f0bc1b17af6a
parent 9b92a55a4dcfb91d91aa41d4cd347c27dc98e48d
Author: triesap <tyson@radroots.org>
Date:   Tue,  4 Aug 2026 11:11:36 +0000

fix(release): preserve standalone sdk checks

- make external cli host generation conditional on capsule presence
- keep cli freshness validation active when the consumer is available
- prevent clean sdk clones from requiring an ambient sibling checkout
- cover absent and present external capsule discovery

Diffstat:
Mtools/sdk_xtask_import/src/cli_host.rs | 35+++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/tools/sdk_xtask_import/src/cli_host.rs b/tools/sdk_xtask_import/src/cli_host.rs @@ -492,7 +492,10 @@ const fn meta( pub fn generate_cli_host() -> Result<(), String> { let root = workspace_root()?; - let cli_root = cli_root(&root); + let Some(cli_root) = cli_root(&root) else { + println!("CLI capsule is absent; skipping external host binding generation"); + return Ok(()); + }; let registry = render_registry()?; let target = render_target()?; write_if_changed( @@ -509,7 +512,10 @@ pub fn generate_cli_host() -> Result<(), String> { pub fn check_cli_host() -> Result<(), String> { let root = workspace_root()?; - let cli_root = cli_root(&root); + let Some(cli_root) = cli_root(&root) else { + println!("CLI capsule is absent; skipping external host binding freshness check"); + return Ok(()); + }; check_file( &cli_root.join("src/generated/runtime_contract_registry.rs"), &render_registry()?, @@ -520,8 +526,12 @@ pub fn check_cli_host() -> Result<(), String> { ) } -fn cli_root(sdk_root: &Path) -> PathBuf { - sdk_root.join("../cli") +fn cli_root(sdk_root: &Path) -> Option<PathBuf> { + let candidate = sdk_root.join("../cli"); + if !candidate.join("Cargo.toml").is_file() { + return None; + } + candidate.canonicalize().ok() } fn check_file(path: &Path, expected: &str) -> Result<(), String> { @@ -647,3 +657,20 @@ fn namespace(operation_id: &str) -> &str { fn mcp_tool(operation_id: &str) -> String { operation_id.replace('.', "_") } + +#[cfg(test)] +mod tests { + #[test] + fn absent_external_cli_capsule_is_not_a_standalone_sdk_requirement() { + let root = tempfile::tempdir().expect("temp root"); + let sdk = root.path().join("sdk"); + std::fs::create_dir(&sdk).expect("sdk directory"); + assert!(super::cli_root(&sdk).is_none()); + + let cli = root.path().join("cli"); + std::fs::create_dir(&cli).expect("cli directory"); + std::fs::write(cli.join("Cargo.toml"), "[package]\nname = \"consumer\"\n") + .expect("consumer manifest"); + assert_eq!(super::cli_root(&sdk).as_deref(), Some(cli.as_path())); + } +}