v0.3.2-pre.007

This commit is contained in:
2026-08-29 21:40:57 +02:00
parent c4f56d9e85
commit e39cf656b2
19 changed files with 849 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-lib/tests/dependency_boundary.rs
// version: 5
// version: 6
#![warn(missing_docs)]
#![deny(unreachable_pub)]
@@ -34,6 +34,8 @@ fn pre_005_manifest_keeps_backend_physical_dependencies_out_of_facade() {
fn pre_005_facade_exposes_no_physical_postgres_types_or_environment_bypass() {
let crate_root = include_str!("../src/lib.rs");
assert!(crate_root.contains("pub use self::settings::StoreSettings;"));
assert!(crate_root.contains("pub use self::health::StoreHealthSnapshot;"));
assert!(crate_root.contains("pub use self::health::StoreRuntimeSnapshot;"));
assert!(crate_root.contains("pub use self::store::Store;"));
assert!(crate_root.contains("pub use ksp_store_api::RawTransaction;"));
assert!(crate_root.contains("const _: &str = crate::TRACING_TARGET;"));
@@ -50,7 +52,7 @@ fn pre_005_facade_exposes_no_physical_postgres_types_or_environment_bypass() {
] {
assert!(!crate_root.contains(forbidden), "forbidden physical backend facade surface detected: {forbidden}");
}
let production = format!("{}\n{}", include_str!("../src/settings.rs"), include_str!("../src/store.rs"));
let production = format!("{}\n{}\n{}", include_str!("../src/health.rs"), include_str!("../src/settings.rs"), include_str!("../src/store.rs"));
for forbidden in ["ksp_config_lib", "std::env", "dotenv", "PGHOST", "PGPORT", "PGUSER", "PGPASSWORD", ".pgpass", "tokio_postgres", "deadpool_postgres"] {
assert!(!production.contains(forbidden), "forbidden Store facade ownership bypass detected: {forbidden}");
}

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-lib/tests/public_api.rs
// version: 4
// version: 5
#![warn(missing_docs)]
#![deny(unreachable_pub)]
@@ -25,6 +25,8 @@ fn pre_003_settings_and_lifecycle_contract_are_available_from_crate_root() {
assert!(settings.validate().is_ok());
let _open = ksp_store_lib::Store::open;
let _close = ksp_store_lib::Store::close;
let _runtime_snapshot = ksp_store_lib::Store::runtime_snapshot;
let _health = ksp_store_lib::Store::health;
return;
}
@@ -36,6 +38,7 @@ fn pre_005_common_and_postgres_error_codes_are_stable_and_store_owned() {
assert_eq!(ksp_store_lib::ERROR_CODE_BACKEND_OPEN_FAILED.code(), "backend_open_failed");
assert_eq!(ksp_store_lib::ERROR_CODE_POSTGRES_CONFIG_INVALID.code(), "postgres_config_invalid");
assert_eq!(ksp_store_lib::ERROR_CODE_POSTGRES_CONNECT_FAILED.code(), "postgres_connect_failed");
assert_eq!(ksp_store_lib::ERROR_CODE_POSTGRES_HEALTH_FAILED.code(), "postgres_health_failed");
assert_eq!(ksp_store_lib::ERROR_CODE_POSTGRES_POOL_TIMEOUT.code(), "postgres_pool_timeout");
assert_eq!(ksp_store_lib::ERROR_CODE_POSTGRES_MIGRATION_FAILED.code(), "postgres_migration_failed");
assert_eq!(ksp_store_lib::ERROR_CODE_POSTGRES_MIGRATION_MISMATCH.code(), "postgres_migration_mismatch");
@@ -55,3 +58,11 @@ fn pre_003_facade_reexports_backend_agnostic_store_api_types() {
let _result: ksp_store_lib::Result<()> = std::result::Result::Ok(());
return;
}
#[test]
fn pre_007_health_and_runtime_snapshot_types_are_portable_crate_root_contracts() {
let _state = std::mem::size_of::<std::option::Option<ksp_store_lib::StoreHealthState>>();
let _health = std::mem::size_of::<std::option::Option<ksp_store_lib::StoreHealthSnapshot>>();
let _runtime = std::mem::size_of::<std::option::Option<ksp_store_lib::StoreRuntimeSnapshot>>();
return;
}