v0.2.1-pre.005

This commit is contained in:
2026-08-17 20:27:44 +02:00
parent bc71fba289
commit ac1b1033c4
18 changed files with 1284 additions and 49 deletions

View File

@@ -1,59 +0,0 @@
// file: crates/ksp-onchain-transport-lib/tests/dependency_boundary.rs
// version: 5
//! Integration canary for the direct dependency firewall of `ksp-onchain-transport-lib`.
#[test]
fn transport_manifest_preserves_ksp_dependency_firewall() {
let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml");
let manifest = std::fs::read_to_string(manifest_path).expect("transport manifest must be readable during integration tests");
for forbidden in ["ksp-config-lib", "ksp-store-api", "ksp-store-lib", "ksp-program-api", "ksp-program-lib", "tracing =", "tracing."] {
assert!(!manifest.contains(forbidden), "forbidden direct transport dependency detected: {forbidden}");
}
assert!(manifest.contains("ksp-core-lib"));
assert!(manifest.contains("ksp-logging-lib"));
assert!(manifest.contains("reqwest = { workspace = true, features = [\"rustls\"] }"));
assert!(manifest.contains("tokio = { workspace = true, features = [\"macros\", \"sync\", \"time\"] }"));
assert!(manifest.contains("[dev-dependencies]"));
assert!(manifest.contains("tokio = { workspace = true, features = [\"rt\"] }"));
}
#[test]
fn workspace_dependency_table_does_not_activate_consumer_features() {
let manifest_directory = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
let workspace_root = manifest_directory.parent().and_then(std::path::Path::parent);
assert!(workspace_root.is_some(), "transport crate must have a workspace root");
let workspace_root = match workspace_root {
std::option::Option::Some(value) => value,
std::option::Option::None => return,
};
let manifest_path = workspace_root.join("Cargo.toml");
let manifest = std::fs::read_to_string(manifest_path.as_path());
assert!(manifest.is_ok(), "workspace manifest must be readable during integration tests");
let manifest = match manifest {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
let workspace_dependencies = match manifest.split("[workspace.dependencies]").nth(1) {
std::option::Option::Some(tail) => tail.split("[workspace.lints.rust]").next(),
std::option::Option::None => std::option::Option::None,
};
assert!(workspace_dependencies.is_some(), "workspace dependencies section must exist");
let workspace_dependencies = match workspace_dependencies {
std::option::Option::Some(value) => value,
std::option::Option::None => return,
};
for line in workspace_dependencies.lines() {
let content = match line.split('#').next() {
std::option::Option::Some(value) => value,
std::option::Option::None => continue,
};
for inline_field in content.split(',') {
let key = match inline_field.split('=').next() {
std::option::Option::Some(value) => value.trim().trim_start_matches('{').trim(),
std::option::Option::None => continue,
};
assert_ne!(key, "features", "consumer feature activation must stay in member manifests");
}
}
}

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-onchain-transport-lib/tests/public_api.rs
// version: 4
// version: 5
//! Integration tests for the public `ksp-onchain-transport-lib` consumer contract.
@@ -160,3 +160,14 @@ async fn public_async_admission_exposes_bounded_permit_without_endpoint_url() {
assert!(!rendered.contains("ASYNC-SECRET-CANARY"));
assert!(!rendered.contains("provider.invalid"));
}
#[test]
fn public_typed_canary_contracts_are_available_from_crate_root() {
let config = ksp_onchain_transport_lib::GetBalanceConfig::new(
std::option::Option::Some(ksp_onchain_transport_lib::SolanaCommitment::Confirmed),
std::option::Option::Some(42),
);
assert_eq!(config.commitment(), std::option::Option::Some(ksp_onchain_transport_lib::SolanaCommitment::Confirmed));
assert_eq!(config.min_context_slot(), std::option::Option::Some(42));
assert_eq!(ksp_onchain_transport_lib::SolanaNodeHealth::Healthy, ksp_onchain_transport_lib::SolanaNodeHealth::Healthy);
}