v0.3.4-pre.004

This commit is contained in:
2026-08-30 21:57:23 +02:00
parent dad18c16d5
commit fb8b585aa2
11 changed files with 1065 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-postgres-lib/tests/dependency_boundary.rs
// version: 16
// version: 17
#![warn(missing_docs)]
#![deny(unreachable_pub)]
@@ -126,7 +126,7 @@ fn pre_003_fix_001_migration_engine_uses_split_schema_contract_and_binds_network
}
#[test]
fn pre_003_v002_schema_is_complete_but_still_does_not_open_account_repository_or_runtime_dispatch() {
fn pre_003_v002_schema_is_complete_without_account_trait_or_write_dispatch() {
let crate_root = include_str!("../src/lib.rs");
let migration = include_str!("../src/migration.rs");
let schema = include_str!("../src/schema.rs");
@@ -148,9 +148,45 @@ fn pre_003_v002_schema_is_complete_but_still_does_not_open_account_repository_or
assert!(slot_check.contains("slot >= 0 AND slot <= 18446744073709551615"));
assert!(index.contains("ON ksp_raw_account_states (slot, pubkey, state_hash)"));
assert!(!index.contains("WHERE"));
assert!(!crate_root.contains("mod raw_account;"));
assert!(!runtime.contains("impl ksp_store_api::RawAccount"));
assert!(!std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/raw_account.rs").exists());
return;
}
#[test]
fn pre_004_raw_account_read_sql_and_mapping_remain_backend_private_and_read_only() {
let crate_root = include_str!("../src/lib.rs");
let raw = include_str!("../src/raw_account.rs");
let runtime = include_str!("../src/runtime.rs");
assert!(crate_root.contains("mod raw_account;"));
assert!(!crate_root.contains("pub mod raw_account"));
for required in [
"GET_ACCOUNT_STATE_SQL",
"GET_ACCOUNT_OBSERVATION_SQL",
"slot::text AS slot_text",
"lamports::text AS lamports_text",
"rent_epoch::text AS rent_epoch_text",
"write_version::text AS write_version_text",
"RawAccountState::try_new",
"RawAccountObservation::new",
"PostgresBackendErrorKind::DataInvalid",
"PostgresBackendErrorKind::WrongNetwork",
] {
assert!(raw.contains(required), "missing private RAW account read mapping contract: {required}");
}
for forbidden in ["INSERT INTO", "UPDATE ", "DELETE FROM", "ON CONFLICT", "FOR UPDATE", " OFFSET ", "list_raw_account_states"] {
assert!(!raw.contains(forbidden), "pre.004 account module contains write/pagination material: {forbidden}");
}
for forbidden in [
"impl ksp_store_api::RawAccountStateRead for PostgresBackend",
"impl ksp_store_api::RawAccountStateWrite for PostgresBackend",
"impl ksp_store_api::RawAccountObservationRead for PostgresBackend",
"impl ksp_store_api::RawAccountObservationWrite for PostgresBackend",
] {
assert!(!runtime.contains(forbidden), "pre.004 opened RawAccount trait scope prematurely: {forbidden}");
}
for forbidden in ["std::env", "dotenv", "ksp_store_lib", "ksp_config_lib"] {
assert!(!raw.contains(forbidden), "RAW account module contains forbidden ownership material: {forbidden}");
}
return;
}

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-postgres-lib/tests/hardening_completeness.rs
// version: 12
// version: 13
#![warn(missing_docs)]
#![deny(unreachable_pub)]
@@ -109,7 +109,8 @@ fn assert_pre_io_rejection(connection_uri: &str, tls_mode: ksp_store_postgres_li
#[test]
fn pre_009_backend_modules_exports_and_manifest_dependencies_are_exact() {
let crate_root = include_str!("../src/lib.rs");
for required in ["mod constants;", "mod error;", "mod health;", "mod migration;", "mod raw_transaction;", "mod runtime;", "mod schema;"] {
for required in ["mod constants;", "mod error;", "mod health;", "mod migration;", "mod raw_account;", "mod raw_transaction;", "mod runtime;", "mod schema;"]
{
assert!(crate_root.contains(required), "missing PostgreSQL backend module: {required}");
}
assert!(!crate_root.contains("pub mod "));
@@ -172,6 +173,7 @@ fn pre_009_backend_error_bridge_cannot_retain_external_error_or_secret_text() {
runtime,
include_str!("../src/migration.rs"),
include_str!("../src/health.rs"),
include_str!("../src/raw_account.rs"),
include_str!("../src/raw_transaction.rs"),
include_str!("../src/raw_transaction/cursor.rs"),
] {
@@ -192,11 +194,13 @@ fn pre_009_backend_has_no_env_bypass_reverse_facade_edge_or_raw_account_trait_im
{}
{}
{}
{}
{}",
include_str!("../src/error.rs"),
include_str!("../src/health.rs"),
include_str!("../src/lib.rs"),
include_str!("../src/migration.rs"),
include_str!("../src/raw_account.rs"),
include_str!("../src/raw_transaction.rs"),
include_str!("../src/raw_transaction/cursor.rs"),
include_str!("../src/runtime.rs"),

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-postgres-lib/tests/public_api.rs
// version: 9
// version: 10
#![warn(missing_docs)]
#![deny(unreachable_pub)]
@@ -75,6 +75,13 @@ fn pre_003_retention_compaction_error_code_matches_store_contract_value() {
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_004_raw_read_bridge_uses_only_backend_independent_models() {
let _get = ksp_store_postgres_lib::PostgresBackend::get_raw_transaction;