v0.3.8-pre.004

This commit is contained in:
2026-09-03 12:32:53 +02:00
parent 009b957523
commit c4198ac656
17 changed files with 902 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-lib/tests/dependency_boundary.rs
// version: 8
// version: 9
#![warn(missing_docs)]
#![deny(unreachable_pub)]
@@ -60,13 +60,14 @@ fn pre_005_facade_exposes_no_physical_postgres_types_or_environment_bypass() {
}
#[test]
fn pre_008_facade_dispatches_exact_ten_raw_capabilities_without_physical_leak() {
fn v0_3_8_pre_004_facade_dispatches_eleven_raw_capabilities_without_physical_leak() {
let store = include_str!("../src/store.rs");
for required in [
"impl ksp_store_api::RawAccountObservationRead for Store",
"impl ksp_store_api::RawAccountObservationWrite for Store",
"impl ksp_store_api::RawAccountStateRead for Store",
"impl ksp_store_api::RawAccountStateWrite for Store",
"impl ksp_store_api::RawTransactionInspectionRead for Store",
"impl ksp_store_api::RawTransactionObservationRead for Store",
"impl ksp_store_api::RawTransactionObservationWrite for Store",
"impl ksp_store_api::RawTransactionRead for Store",
@@ -79,7 +80,7 @@ fn pre_008_facade_dispatches_exact_ten_raw_capabilities_without_physical_leak()
] {
assert!(store.contains(required), "missing pre.008 Store capability dispatch contract: {required}");
}
assert_eq!(store.matches("impl ksp_store_api::Raw").count(), 10);
assert_eq!(store.matches("impl ksp_store_api::Raw").count(), 11);
for forbidden in ["tokio_postgres::", "deadpool_postgres::", "CREATE TABLE", "INSERT INTO", "UPDATE ksp_", "DELETE FROM"] {
assert!(!store.contains(forbidden), "pre.008 facade leaked physical backend material: {forbidden}");
}

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-lib/tests/hardening_completeness.rs
// version: 7
// version: 8
#![warn(missing_docs)]
#![deny(unreachable_pub)]
@@ -292,13 +292,14 @@ fn pre_009_facade_production_sources_keep_config_env_physical_sql_and_backend_ha
}
#[test]
fn pre_010_facade_raw_capability_inventory_is_exactly_ten() {
fn v0_3_8_pre_004_facade_raw_capability_inventory_is_exactly_eleven() {
let store = include_str!("../src/store.rs");
let capability_impls = [
"impl ksp_store_api::RawAccountObservationRead for Store",
"impl ksp_store_api::RawAccountObservationWrite for Store",
"impl ksp_store_api::RawAccountStateRead for Store",
"impl ksp_store_api::RawAccountStateWrite for Store",
"impl ksp_store_api::RawTransactionInspectionRead for Store",
"impl ksp_store_api::RawTransactionObservationRead for Store",
"impl ksp_store_api::RawTransactionObservationWrite for Store",
"impl ksp_store_api::RawTransactionRead for Store",
@@ -309,20 +310,22 @@ fn pre_010_facade_raw_capability_inventory_is_exactly_ten() {
for implementation in capability_impls {
assert_eq!(store.matches(implementation).count(), 1, "unexpected Store capability implementation inventory: {implementation}");
}
assert_eq!(store.matches("impl ksp_store_api::Raw").count(), 10);
assert_eq!(store.matches("validate_operation_network(").count(), 14);
assert_eq!(store.matches("impl ksp_store_api::Raw").count(), 11);
assert_eq!(store.matches("validate_operation_network(").count(), 15);
return;
}
#[test]
fn pre_010_facade_and_backend_raw_capability_sets_match_exactly_without_account_retention() {
fn v0_3_8_pre_004_facade_and_backend_capability_sets_match_with_transaction_inspection_only() {
let store = include_str!("../src/store.rs");
let backend = include_str!("../../ksp-store-postgres-lib/src/runtime.rs");
let store_traits = raw_capability_trait_names(store, " for Store");
let backend_traits = raw_capability_trait_names(backend, " for PostgresBackend");
assert_eq!(store_traits.len(), 10);
assert_eq!(backend_traits.len(), 10);
assert_eq!(store_traits.len(), 11);
assert_eq!(backend_traits.len(), 11);
assert_eq!(store_traits, backend_traits);
assert!(store_traits.contains(&"RawTransactionInspectionRead"));
assert!(!store_traits.contains(&"RawAccountStateInspectionRead"));
for forbidden in ["RawAccountRetentionRead", "RawAccountRetentionWrite", "RawAccountDelete", "RawAccountCompaction"] {
assert!(!store_traits.contains(&forbidden), "unexpected account capability added to Store: {forbidden}");
assert!(!backend_traits.contains(&forbidden), "unexpected account capability added to PostgreSQL backend: {forbidden}");

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-lib/tests/public_api.rs
// version: 9
// version: 10
#![warn(missing_docs)]
#![deny(unreachable_pub)]
@@ -83,6 +83,7 @@ where
+ ksp_store_lib::RawAccountObservationWrite
+ ksp_store_lib::RawAccountStateRead
+ ksp_store_lib::RawAccountStateWrite
+ ksp_store_lib::RawTransactionInspectionRead
+ ksp_store_lib::RawTransactionObservationRead
+ ksp_store_lib::RawTransactionObservationWrite
+ ksp_store_lib::RawTransactionRead
@@ -95,7 +96,7 @@ where
}
#[test]
fn pre_008_store_facade_implements_exact_raw_capability_set_10_of_10() {
fn v0_3_8_pre_004_store_facade_implements_raw_transaction_inspection_as_capability_11_of_11() {
assert_raw_capabilities::<ksp_store_lib::Store>();
return;
}