lib

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

commit 3bc687d567220d4ee133504ff3ebb008860f8c45
parent 00b6b5e3859930989deb29c3c092f3aa544e73e0
Author: triesap <tyson@radroots.org>
Date:   Wed, 15 Jul 2026 22:38:02 +0000

build: close SDK warning hygiene

- factor generated binding test function types for clippy

- align xtask DTO inventory with the current generated event surface

- tighten xtask filesystem and coverage helpers for warning-clean validation

- validate with SDK fmt, test, and clippy lanes

Diffstat:
Mcrates/event_codec_wasm/src/lib.rs | 4+++-
Mcrates/sdk_sql_wasm_runtime/src/lib.rs | 2+-
Mtools/sdk_xtask_import/src/check.rs | 11+++--------
Mtools/sdk_xtask_import/src/coverage.rs | 5+----
Mtools/sdk_xtask_import/src/coverage_policy_tests.rs | 6+++---
Mtools/sdk_xtask_import/src/dto_roots.rs | 2--
Mtools/sdk_xtask_import/src/fs.rs | 16++++++++--------
7 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/crates/event_codec_wasm/src/lib.rs b/crates/event_codec_wasm/src/lib.rs @@ -1249,9 +1249,11 @@ mod tests { }) } + type BindingEncoder = fn(&str) -> Result<String, RadrootsJsValue>; + #[test] fn bindings_reject_invalid_json() { - let bindings: [fn(&str) -> Result<String, RadrootsJsValue>; 46] = [ + let bindings: [BindingEncoder; 46] = [ listing_tags, listing_tags_full, post_tags, diff --git a/crates/sdk_sql_wasm_runtime/src/lib.rs b/crates/sdk_sql_wasm_runtime/src/lib.rs @@ -423,7 +423,7 @@ mod tests { let _guard = native_test_lock().lock().expect("native test lock"); reset_native_state(); - let executor = WasmSqlExecutor::default(); + let executor = WasmSqlExecutor; push_exec_result(Ok(json!({"changes": 2, "lastInsertRowid": 99}))); let outcome = executor .exec("insert into listing values (?)", r#"["bin-1"]"#) diff --git a/tools/sdk_xtask_import/src/check.rs b/tools/sdk_xtask_import/src/check.rs @@ -387,12 +387,7 @@ fn check_package_source_metadata(root: &Path) -> Result<(), String> { let index_path = package_dir.join("src/index.ts"); let package_json = check_package_json(&package_json_path, spec.package_name, spec.package_dir)?; - check_package_distribution_metadata( - &root, - &package_dir, - &package_json_path, - &package_json, - )?; + check_package_distribution_metadata(root, &package_dir, &package_json_path, &package_json)?; if !index_path.is_file() { return Err(format!("missing package index: {}", index_path.display())); } @@ -2594,8 +2589,8 @@ transport-reticulum-preview = [] } fn write_distribution_metadata( - root: &PathBuf, - package_dir: &PathBuf, + root: &Path, + package_dir: &Path, package_name: &str, description: &str, ) { diff --git a/tools/sdk_xtask_import/src/coverage.rs b/tools/sdk_xtask_import/src/coverage.rs @@ -95,10 +95,7 @@ fn output(command: &str, args: &[&str]) -> Result<String, String> { .output() .map_err(|error| error.to_string())?; if !output.status.success() { - return Err(format!( - "{}", - String::from_utf8_lossy(&output.stderr).trim() - )); + return Err(String::from_utf8_lossy(&output.stderr).trim().to_string()); } Ok(String::from_utf8_lossy(&output.stdout).to_string()) } diff --git a/tools/sdk_xtask_import/src/coverage_policy_tests.rs b/tools/sdk_xtask_import/src/coverage_policy_tests.rs @@ -1,6 +1,6 @@ use std::{ fs, - path::PathBuf, + path::{Path, PathBuf}, time::{SystemTime, UNIX_EPOCH}, }; @@ -97,13 +97,13 @@ fn report_json(filename: &str, file_metrics: Metrics, totals: Metrics) -> String ) } -fn write_report(root: &PathBuf, raw: &str) -> PathBuf { +fn write_report(root: &Path, raw: &str) -> PathBuf { let report_path = root.join("summary.json"); fs::write(&report_path, raw).expect("write report"); report_path } -fn scope_file(root: &PathBuf) -> String { +fn scope_file(root: &Path) -> String { root.join("tools/xtask/src/coverage_policy.rs") .display() .to_string() diff --git a/tools/sdk_xtask_import/src/dto_roots.rs b/tools/sdk_xtask_import/src/dto_roots.rs @@ -665,8 +665,6 @@ mod tests { "RadrootsSocialMediaMetadata", "RadrootsSocialMediaThumbnail", "RadrootsSocialTarget", - "RadrootsTradeListingValidateRequest", - "RadrootsTradeListingValidateResult", "RadrootsTradeValidationListingError", "RadrootsVerifiedSignedEventDto", "RadrootsVerifiedSignedEventVerificationStateDto", diff --git a/tools/sdk_xtask_import/src/fs.rs b/tools/sdk_xtask_import/src/fs.rs @@ -19,10 +19,10 @@ pub fn workspace_root() -> Result<PathBuf, String> { #[allow(dead_code)] pub fn write_if_changed(path: &Path, contents: &str) -> Result<bool, String> { - if let Ok(existing) = fs::read_to_string(path) { - if existing == contents { - return Ok(false); - } + if let Ok(existing) = fs::read_to_string(path) + && existing == contents + { + return Ok(false); } if let Some(parent) = path.parent() { fs::create_dir_all(parent) @@ -34,10 +34,10 @@ pub fn write_if_changed(path: &Path, contents: &str) -> Result<bool, String> { } pub fn write_bytes_if_changed(path: &Path, contents: &[u8]) -> Result<bool, String> { - if let Ok(existing) = fs::read(path) { - if existing == contents { - return Ok(false); - } + if let Ok(existing) = fs::read(path) + && existing == contents + { + return Ok(false); } if let Some(parent) = path.parent() { fs::create_dir_all(parent)