lib

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

commit 65410d47c90160ab45c91b185101fdcf6cdf7e12
parent 2b90ccb46a99d153e76867acc19e2a275cb52a08
Author: triesap <tyson@radroots.org>
Date:   Sat, 10 Oct 2026 21:52:48 +0000

toolchain: adopt Rust 1.99 and compatible slice iteration

- Pin the development compiler and current target policy to Rust 1.99.0.
- Preserve the public Rust 1.97.1 minimum and historical release contracts.
- Modernize fixed-size hexadecimal iteration while preserving validation and zeroization.
- Verify compiler policy, API and coverage while retaining bounded admission diagnostics.

Diffstat:
MAGENTS.md | 3++-
Mcontracts/architecture/deviations.toml | 15+++++++++++++++
Mcontracts/releases/target_matrix.toml | 2+-
Mcrates/event/src/id.rs | 2+-
Mcrates/mesh/tests/mesh.rs | 4+++-
Mcrates/runtime_distribution/src/service_artifact.rs | 4++--
Mcrates/secrets/src/keyring.rs | 4+++-
Mcrates/service_sqlite/src/backup/manifest.rs | 2+-
Mcrates/service_sqlite/src/restore/marker.rs | 2+-
Mrust-toolchain.toml | 2+-
Mtools/xtask/src/architecture.rs | 13++++++-------
Mtools/xtask/src/safe_artifact_io.rs | 3+--
Mtools/xtask/src/service_release_artifacts.rs | 13++++++++++---
Mtools/xtask/src/target_qualification.rs | 15+++++++++++----
14 files changed, 58 insertions(+), 26 deletions(-)

diff --git a/AGENTS.md b/AGENTS.md @@ -144,7 +144,8 @@ Before editing code: ## 6. Rust engineering rules -- Use Rust `1.97.1`, edition `2024`, resolver `3`, and workspace dependency +- Use Rust `1.99.0` for development, retaining minimum supported Rust `1.97.1`, + edition `2024`, resolver `3`, and workspace dependency versions from the root `Cargo.toml` after the release-v1 workspace cutover. - Preserve intended `no_std` portability; gate `std`, wasm, and runtime-specific behavior explicitly. - Keep core logic functional and composable: prefer pure transformations, explicit state, and narrow side-effect boundaries. diff --git a/contracts/architecture/deviations.toml b/contracts/architecture/deviations.toml @@ -595,3 +595,18 @@ closure_evidence = [ "crates/transport_nostr/src/source.rs tests remote selector translation and defensive result filtering before page bounds.", "Steps 282 and 283 qualified the SDK-owned signing, Nostr composition, and mobile presentation bridge without lower-package ownership leakage.", ] + +[[deviation]] +id = "RCRV1-DEV-024" +date = "2026-10-10" +status = "closed" +approval = "Explicit user authorization requires Rust 1.99 and necessary owning-repository repairs, verified commits and normal source pushes." +affected_steps = ["018", "299"] +spec_anchors = ["contracts/crates/release_v1/radroots_crates_release_v1.toml#repository_policy"] +source_evidence = ["The development toolchain is pinned to 1.99.0 while package rust-version and the immutable release-v1 specification declare minimum supported Rust 1.97.1.", "Existing architecture validation conflated the development compiler with the public package minimum; the target matrix previously selected floating stable."] +replacement_action = "Pin current development qualification to Rust 1.99.0 and validate it separately from unchanged MSRV 1.97.1; use fixed-size slice iteration for the required hexadecimal parsing lint while retaining validation, zeroization, public APIs and release-v1 contracts." +verification = ["Run exact workspace format, check, tests and warnings-as-errors Clippy under 1.99.0.", "Run architecture, contracts, catalog, source/API boundary and graph controls, public feature matrix, supported SDK/WASM profiles and generated freshness.", "Verify the changed Event source against its pinned public API and unchanged coverage policy, and check compatibility with the retained minimum compiler.", "Reject the former development compiler and floating current compiler in policy controls; obtain independent exact-source acceptance before commit and source push."] +unresolved_risk = "Current Rust1.99 owner checks pass. Downstream adoption and native qualification remain separate; earlier intermittent release-fixture failures remain preserved with cause unknown." +normative_architecture_change = false +adr_required = false +closure_evidence = ["Rust1.99.0 complete workspace compilation and all277 original compiled test executables, all12 profile cases, warnings-as-errors Clippy/Rustdoc, public feature matrix, SDK/WASM and source/contract/freshness checks pass with the reviewed fixed-size parsing correction and unchanged public APIs.", "Complete xtask and the original focused reproducible-artifact case pass under unchanged admission and watchdog policies; independent exact-source acceptance remains required before commit."] diff --git a/contracts/releases/target_matrix.toml b/contracts/releases/target_matrix.toml @@ -1,6 +1,6 @@ schema_version = 1 msrv_toolchain = "1.97.1" -current_toolchain = "stable" +current_toolchain = "1.99.0" [[operating_system]] name = "linux" diff --git a/crates/event/src/id.rs b/crates/event/src/id.rs @@ -561,7 +561,7 @@ fn decode_hex<const N: usize>(value: &str) -> Result<[u8; N], ParseError> { } let mut decoded = [0_u8; N]; - for (index, pair) in value.as_bytes().chunks_exact(2).enumerate() { + for (index, pair) in value.as_bytes().as_chunks::<2>().0.iter().enumerate() { decoded[index] = (decode_hex_nibble(pair[0])? << 4) | decode_hex_nibble(pair[1])?; } Ok(decoded) diff --git a/crates/mesh/tests/mesh.rs b/crates/mesh/tests/mesh.rs @@ -581,7 +581,9 @@ fn decode_hex(value: &str) -> Vec<u8> { assert_eq!(value.len() % 2, 0, "hex fixture length must be even"); value .as_bytes() - .chunks_exact(2) + .as_chunks::<2>() + .0 + .iter() .map(|chunk| { let high = hex_nibble(chunk[0]); let low = hex_nibble(chunk[1]); diff --git a/crates/runtime_distribution/src/service_artifact.rs b/crates/runtime_distribution/src/service_artifact.rs @@ -70,7 +70,7 @@ impl<'de> Deserialize<'de> for ServiceArtifactSha256 { return Err(serde::de::Error::custom("invalid sha256")); } let mut bytes = [0_u8; 32]; - for (index, pair) in value.as_bytes().chunks_exact(2).enumerate() { + for (index, pair) in value.as_bytes().as_chunks::<2>().0.iter().enumerate() { bytes[index] = (hex_nibble(pair[0]) .ok_or_else(|| serde::de::Error::custom("invalid sha256"))? << 4) @@ -229,7 +229,7 @@ impl HardenedServiceArtifact { fn sha256_literal(value: &str) -> ServiceArtifactSha256 { let mut bytes = [0_u8; 32]; - for (index, pair) in value.as_bytes().chunks_exact(2).enumerate() { + for (index, pair) in value.as_bytes().as_chunks::<2>().0.iter().enumerate() { bytes[index] = (hex_nibble(pair[0]).expect("literal sha256") << 4) | hex_nibble(pair[1]).expect("literal sha256"); } diff --git a/crates/secrets/src/keyring.rs b/crates/secrets/src/keyring.rs @@ -310,7 +310,9 @@ fn hex_decode(value: &str) -> Result<Vec<u8>, Error> { } value .as_bytes() - .chunks_exact(2) + .as_chunks::<2>() + .0 + .iter() .map(|pair| { let high = hex_nibble(pair[0])?; let low = hex_nibble(pair[1])?; diff --git a/crates/service_sqlite/src/backup/manifest.rs b/crates/service_sqlite/src/backup/manifest.rs @@ -524,7 +524,7 @@ fn encode_hex(bytes: &[u8; 32]) -> String { fn decode_hex_32(value: &str) -> Option<[u8; 32]> { (value.len() == 64).then_some(())?; let mut decoded = [0_u8; 32]; - for (index, pair) in value.as_bytes().chunks_exact(2).enumerate() { + for (index, pair) in value.as_bytes().as_chunks::<2>().0.iter().enumerate() { let high = decode_lower_hex(pair[0])?; let low = decode_lower_hex(pair[1])?; decoded[index] = (high << 4) | low; diff --git a/crates/service_sqlite/src/restore/marker.rs b/crates/service_sqlite/src/restore/marker.rs @@ -583,7 +583,7 @@ fn decode_hex_32(value: &str) -> Result<[u8; 32], RestoreMarkerContractError> { return Err(RestoreMarkerContractError::InvalidIdentity); } let mut output = [0_u8; 32]; - for (index, pair) in value.as_bytes().chunks_exact(2).enumerate() { + for (index, pair) in value.as_bytes().as_chunks::<2>().0.iter().enumerate() { output[index] = (decode_nibble(pair[0])? << 4) | decode_nibble(pair[1])?; } Ok(output) diff --git a/rust-toolchain.toml b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.97.1" +channel = "1.99.0" components = ["clippy", "rust-analyzer", "rust-src", "rustfmt"] targets = ["wasm32-unknown-unknown"] diff --git a/tools/xtask/src/architecture.rs b/tools/xtask/src/architecture.rs @@ -304,11 +304,10 @@ fn validate_workspace_toolchain( .get("toolchain") .and_then(|value| value.get("channel")) .and_then(toml::Value::as_str); - if channel != Some(architecture.rust_version.as_str()) { - return Err(format!( - "rust-toolchain.toml channel must match architecture rust_version {}", - architecture.rust_version - )); + if channel != Some("1.99.0") { + return Err( + "rust-toolchain.toml channel must match development compiler 1.99.0".to_owned(), + ); } Ok(()) } @@ -1412,7 +1411,7 @@ adr_required = false } fs::write( root.join("rust-toolchain.toml"), - "[toolchain]\nchannel = \"1.97.1\"\n", + "[toolchain]\nchannel = \"1.99.0\"\n", ) .expect("write toolchain"); let architecture = architecture(); @@ -1420,7 +1419,7 @@ adr_required = false fs::write( root.join("rust-toolchain.toml"), - "[toolchain]\nchannel = \"1.97.0\"\n", + "[toolchain]\nchannel = \"1.97.1\"\n", ) .expect("write mismatched toolchain"); let error = validate_workspace_toolchain(&root, &architecture) diff --git a/tools/xtask/src/safe_artifact_io.rs b/tools/xtask/src/safe_artifact_io.rs @@ -3418,12 +3418,11 @@ mod tests { #[cfg(all(test, unix))] mod step_294_tests { use std::fs::{self, File}; - use std::io::Write as _; use std::os::unix::fs::PermissionsExt as _; use std::path::{Path, PathBuf}; use flate2::{Compression, GzBuilder}; - use sha2::{Digest as _, Sha256}; + use sha2::Sha256; use tar::{Builder, EntryType, Header}; use tempfile::TempDir; diff --git a/tools/xtask/src/service_release_artifacts.rs b/tools/xtask/src/service_release_artifacts.rs @@ -632,7 +632,11 @@ fn run_inner(arguments: Arguments<'_>) -> Result<(), ReleaseArtifactError> { }, }, ) - .map_err(|_| ReleaseArtifactError::InvalidInputArtifact)?; + .map_err(|_error| { + #[cfg(test)] + eprintln!("OCI admission category: {_error}"); + ReleaseArtifactError::InvalidInputArtifact + })?; input_snapshot .revalidate() .map_err(|_| ReleaseArtifactError::InvalidInputRoot)?; @@ -1920,8 +1924,11 @@ fn create_binary_archive_from_snapshot( if source_evidence.byte_length == 0 { return Err(ReleaseArtifactError::InvalidInputArtifact); } - artifact_admission::admit_binary(&stable_source, target, true) - .map_err(|_| ReleaseArtifactError::InvalidInputArtifact)?; + artifact_admission::admit_binary(&stable_source, target, true).map_err(|_error| { + #[cfg(test)] + eprintln!("binary admission category: {_error}"); + ReleaseArtifactError::InvalidInputArtifact + })?; write_binary_archive( &stable_source, output, diff --git a/tools/xtask/src/target_qualification.rs b/tools/xtask/src/target_qualification.rs @@ -105,8 +105,10 @@ fn validate(matrix: &TargetMatrix) -> Result<(), String> { matrix.schema_version )); } - if matrix.msrv_toolchain != "1.97.1" || matrix.current_toolchain != "stable" { - return Err("target matrix must retain MSRV 1.97.1 and current stable".to_owned()); + if matrix.msrv_toolchain != "1.97.1" || matrix.current_toolchain != "1.99.0" { + return Err( + "target matrix must retain MSRV 1.97.1 and development compiler 1.99.0".to_owned(), + ); } let expected = [ ( @@ -192,7 +194,7 @@ mod tests { .expect("workspace root"); let (matrix, packages) = load(root).expect("target matrix"); assert_eq!(matrix.msrv_toolchain, "1.97.1"); - assert_eq!(matrix.current_toolchain, "stable"); + assert_eq!(matrix.current_toolchain, "1.99.0"); assert_eq!(matrix.operating_system.len(), 2); assert_eq!( matrix @@ -213,7 +215,7 @@ mod tests { let mut matrix = TargetMatrix { schema_version: 1, msrv_toolchain: "1.97.1".to_owned(), - current_toolchain: "stable".to_owned(), + current_toolchain: "1.99.0".to_owned(), operating_system: vec![ OperatingSystem { name: "linux".to_owned(), @@ -229,6 +231,11 @@ mod tests { }, ], }; + for toolchain in ["stable", "1.97.1"] { + matrix.current_toolchain = toolchain.to_owned(); + assert!(validate(&matrix).is_err(), "accepted {toolchain}"); + } + matrix.current_toolchain = "1.99.0".to_owned(); for (name, target) in [ ("windows", "x86_64-pc-windows-gnu"), ("macos", "x86_64-apple-darwin"),