// file: crates/ksp-store-postgres-lib/tests/public_api.rs // version: 16 #![warn(missing_docs)] #![deny(unreachable_pub)] #![forbid(unsafe_code)] //! Narrow physical bridge canaries consumed by `ksp-store-lib` without exposing driver or pool types. #[test] fn pre_005_backend_bridge_is_constructible_without_io() { let network = match ksp_store_api::RawNetworkId::new("devnet") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("valid backend bridge network rejected: {error:?}"), }; let settings = ksp_store_postgres_lib::PostgresBackendSettings::new( network, "postgresql://operator:secret@localhost/ksp", 8, std::time::Duration::from_secs(10), std::time::Duration::from_secs(5), std::time::Duration::from_secs(10), std::time::Duration::from_secs(5), ksp_store_postgres_lib::PostgresBackendTlsMode::VerifyFull, true, std::time::Duration::from_secs(30), std::time::Duration::from_secs(10), ); assert_eq!(settings.network().as_str(), "devnet"); assert_eq!(settings.tls_mode().code(), "verify_full"); let _open = ksp_store_postgres_lib::PostgresBackend::open; let _close = ksp_store_postgres_lib::PostgresBackend::close; return; } #[test] fn pre_005_backend_error_projection_is_safe_and_static() { let kinds = [ ksp_store_postgres_lib::PostgresBackendErrorKind::ConfigInvalid, ksp_store_postgres_lib::PostgresBackendErrorKind::ConnectFailed, ksp_store_postgres_lib::PostgresBackendErrorKind::Conflict, ksp_store_postgres_lib::PostgresBackendErrorKind::DataInvalid, ksp_store_postgres_lib::PostgresBackendErrorKind::PoolTimeout, ksp_store_postgres_lib::PostgresBackendErrorKind::HealthFailed, ksp_store_postgres_lib::PostgresBackendErrorKind::MigrationFailed, ksp_store_postgres_lib::PostgresBackendErrorKind::MigrationMismatch, ksp_store_postgres_lib::PostgresBackendErrorKind::PageLimitUnsupported, ksp_store_postgres_lib::PostgresBackendErrorKind::QueryInvalid, ksp_store_postgres_lib::PostgresBackendErrorKind::ReadFailed, ksp_store_postgres_lib::PostgresBackendErrorKind::ReferenceNotFound, ksp_store_postgres_lib::PostgresBackendErrorKind::RetentionCompactionUnsupported, ksp_store_postgres_lib::PostgresBackendErrorKind::SchemaNewer, ksp_store_postgres_lib::PostgresBackendErrorKind::ShutdownTimeout, ksp_store_postgres_lib::PostgresBackendErrorKind::TlsFailed, ksp_store_postgres_lib::PostgresBackendErrorKind::WriteFailed, ksp_store_postgres_lib::PostgresBackendErrorKind::WrongNetwork, ]; assert_eq!(kinds.len(), 18); return; } #[test] fn pre_007_backend_health_bridge_exposes_only_safe_snapshot_types() { let _runtime = std::mem::size_of::>(); let _health = std::mem::size_of::>(); let _runtime_snapshot = ksp_store_postgres_lib::PostgresBackend::runtime_snapshot; let _health_probe = ksp_store_postgres_lib::PostgresBackend::health; return; } #[test] fn pre_003_retention_compaction_error_code_matches_store_contract_value() { assert_eq!(ksp_store_postgres_lib::ERROR_CODE_POSTGRES_RETENTION_COMPACTION_UNSUPPORTED.domain(), "store"); assert_eq!(ksp_store_postgres_lib::ERROR_CODE_POSTGRES_RETENTION_COMPACTION_UNSUPPORTED.code(), "postgres_retention_compaction_unsupported",); return; } #[test] fn pre_004_raw_account_read_bridge_uses_only_backend_independent_models() { let _state = ksp_store_postgres_lib::PostgresBackend::get_raw_account_state; let _observation = ksp_store_postgres_lib::PostgresBackend::get_raw_account_observation; return; } #[test] fn pre_005_raw_account_acquisition_bridge_uses_only_backend_independent_models_and_outcomes() { let _acquisition = ksp_store_postgres_lib::PostgresBackend::persist_raw_account_acquisition; return; } #[test] fn pre_006_raw_account_observation_write_bridge_uses_only_backend_independent_models_and_outcomes() { let _observation = ksp_store_postgres_lib::PostgresBackend::record_raw_account_observation; return; } #[test] fn pre_007_raw_account_list_bridge_uses_backend_independent_query_page_and_reference_models() { let _list = ksp_store_postgres_lib::PostgresBackend::list_raw_account_states; return; } #[test] fn pre_004_raw_read_bridge_uses_only_backend_independent_models() { let _get = ksp_store_postgres_lib::PostgresBackend::get_raw_transaction; let _observation = ksp_store_postgres_lib::PostgresBackend::get_raw_transaction_observation; let _retention = ksp_store_postgres_lib::PostgresBackend::get_raw_transaction_retention_state; let _tombstone = ksp_store_postgres_lib::PostgresBackend::get_raw_transaction_tombstone; return; } #[test] fn pre_005_raw_write_bridge_uses_only_backend_independent_models_and_outcomes() { let _acquisition = ksp_store_postgres_lib::PostgresBackend::persist_raw_transaction_acquisition; let _observation = ksp_store_postgres_lib::PostgresBackend::record_raw_transaction_observation; return; } #[test] fn v0_3_8_pre_005_raw_list_and_inspection_bridges_use_only_backend_independent_models() { let _account_list = ksp_store_postgres_lib::PostgresBackend::list_raw_account_states; let _account_inspection = ksp_store_postgres_lib::PostgresBackend::inspect_raw_account_states; let _transaction_list = ksp_store_postgres_lib::PostgresBackend::list_raw_transactions; let _transaction_inspection = ksp_store_postgres_lib::PostgresBackend::inspect_raw_transactions; return; } #[test] fn pre_007_raw_retention_write_bridge_uses_backend_independent_transition_and_outcome_models() { let _transition = ksp_store_postgres_lib::PostgresBackend::transition_raw_transaction_retention; return; } fn assert_raw_capabilities() where T: ksp_store_api::RawAccountObservationRead + ksp_store_api::RawAccountObservationWrite + ksp_store_api::RawAccountStateInspectionRead + ksp_store_api::RawAccountStateRead + ksp_store_api::RawAccountStateWrite + ksp_store_api::RawTransactionInspectionRead + ksp_store_api::RawTransactionObservationRead + ksp_store_api::RawTransactionObservationWrite + ksp_store_api::RawTransactionRead + ksp_store_api::RawTransactionRetentionRead + ksp_store_api::RawTransactionRetentionWrite + ksp_store_api::RawTransactionWrite, { let _marker = std::marker::PhantomData::; return; } #[test] fn v0_3_8_pre_005_postgres_backend_implements_both_inspection_capabilities_as_12_of_12() { assert_raw_capabilities::(); return; }