v0.3.2-pre.002
This commit is contained in:
19
crates/ksp-store-lib/Cargo.toml
Normal file
19
crates/ksp-store-lib/Cargo.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
# file: crates/ksp-store-lib/Cargo.toml
|
||||
# version: 1
|
||||
|
||||
[package]
|
||||
name = "ksp-store-lib"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["postgres"]
|
||||
postgres = ["dep:ksp-store-postgres-lib"]
|
||||
|
||||
[dependencies]
|
||||
ksp-store-api = { path = "../ksp-store-api" }
|
||||
ksp-store-postgres-lib = { path = "../ksp-store-postgres-lib", optional = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
7
crates/ksp-store-lib/src/constants.rs
Normal file
7
crates/ksp-store-lib/src/constants.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// file: crates/ksp-store-lib/src/constants.rs
|
||||
// version: 1
|
||||
|
||||
//! Store facade-owned constants.
|
||||
|
||||
/// Owning tracing target reserved for events emitted by the common Store runtime facade.
|
||||
pub(crate) const TRACING_TARGET: &str = "ksp-store-lib";
|
||||
21
crates/ksp-store-lib/src/lib.rs
Normal file
21
crates/ksp-store-lib/src/lib.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
// file: crates/ksp-store-lib/src/lib.rs
|
||||
// version: 1
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
//! Common backend-neutral Store runtime facade for KSP.
|
||||
//!
|
||||
//! `0.3.2-pre.002` establishes only the crate and Cargo feature graph. Runtime
|
||||
//! settings, backend selection, lifecycle, error mapping and API reexports are
|
||||
//! introduced by later prereleases of `0.3.2`.
|
||||
//!
|
||||
//! The default `postgres` feature compiles the official PostgreSQL backend as
|
||||
//! an optional implementation dependency. No backend implementation type is
|
||||
//! part of this crate's public surface.
|
||||
|
||||
mod constants;
|
||||
|
||||
/// Crate-owned tracing target reserved for later Store runtime behavior.
|
||||
pub(crate) use self::constants::TRACING_TARGET;
|
||||
52
crates/ksp-store-lib/tests/dependency_boundary.rs
Normal file
52
crates/ksp-store-lib/tests/dependency_boundary.rs
Normal file
@@ -0,0 +1,52 @@
|
||||
// file: crates/ksp-store-lib/tests/dependency_boundary.rs
|
||||
// version: 1
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
//! Cargo-feature and dependency-boundary canaries for the common Store runtime scaffold.
|
||||
|
||||
#[test]
|
||||
fn pre_002_manifest_owns_default_postgres_feature_and_optional_backend_edge() {
|
||||
let manifest = include_str!("../Cargo.toml");
|
||||
assert!(manifest.contains("default = [\"postgres\"]"));
|
||||
assert!(manifest.contains("postgres = [\"dep:ksp-store-postgres-lib\"]"));
|
||||
assert!(manifest.contains("ksp-store-api = { path = \"../ksp-store-api\" }"));
|
||||
assert!(manifest.contains("ksp-store-postgres-lib = { path = \"../ksp-store-postgres-lib\", optional = true }"));
|
||||
for forbidden in [
|
||||
"ksp-config-lib",
|
||||
"ksp-materializer",
|
||||
"ksp-program",
|
||||
"ksp-onchain-transport-lib",
|
||||
"ksp-offchain-transport-lib",
|
||||
"tokio-postgres",
|
||||
"deadpool-postgres",
|
||||
"rustls",
|
||||
] {
|
||||
assert!(!manifest.contains(forbidden), "forbidden pre.002 Store facade dependency detected: {forbidden}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_002_scaffold_keeps_backend_types_and_future_runtime_surface_private() {
|
||||
let crate_root = include_str!("../src/lib.rs");
|
||||
assert!(crate_root.contains("mod constants;"));
|
||||
assert!(crate_root.contains("pub(crate) use self::constants::TRACING_TARGET;"));
|
||||
for forbidden in [
|
||||
"pub mod ",
|
||||
"pub use ksp_store_postgres_lib",
|
||||
"StoreSettings",
|
||||
"StoreBackendSettings",
|
||||
"PostgresStoreSettings",
|
||||
"pub struct Store",
|
||||
"tokio_postgres",
|
||||
"deadpool_postgres",
|
||||
] {
|
||||
assert!(!crate_root.contains(forbidden), "forbidden pre.002 Store facade surface detected: {forbidden}");
|
||||
}
|
||||
let constants = include_str!("../src/constants.rs");
|
||||
assert!(constants.contains("pub(crate) const TRACING_TARGET: &str = \"ksp-store-lib\";"));
|
||||
return;
|
||||
}
|
||||
14
crates/ksp-store-postgres-lib/Cargo.toml
Normal file
14
crates/ksp-store-postgres-lib/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
# file: crates/ksp-store-postgres-lib/Cargo.toml
|
||||
# version: 1
|
||||
|
||||
[package]
|
||||
name = "ksp-store-postgres-lib"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[dependencies]
|
||||
ksp-store-api = { path = "../ksp-store-api" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
7
crates/ksp-store-postgres-lib/src/constants.rs
Normal file
7
crates/ksp-store-postgres-lib/src/constants.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// file: crates/ksp-store-postgres-lib/src/constants.rs
|
||||
// version: 1
|
||||
|
||||
//! PostgreSQL Store backend-owned constants.
|
||||
|
||||
/// Owning tracing target reserved for events emitted by the PostgreSQL Store backend.
|
||||
pub(crate) const TRACING_TARGET: &str = "ksp-store-postgres-lib";
|
||||
21
crates/ksp-store-postgres-lib/src/lib.rs
Normal file
21
crates/ksp-store-postgres-lib/src/lib.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
// file: crates/ksp-store-postgres-lib/src/lib.rs
|
||||
// version: 1
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
//! Official PostgreSQL backend implementation scaffold for KSP Store.
|
||||
//!
|
||||
//! `0.3.2-pre.002` establishes only the backend crate boundary. PostgreSQL
|
||||
//! driver, pooling, TLS, SQL, migrations and health behavior are intentionally
|
||||
//! absent until their dedicated prereleases.
|
||||
//!
|
||||
//! This crate depends on `ksp-store-api` and never on `ksp-store-lib`, which
|
||||
//! keeps backend implementation ownership acyclic and reusable behind the
|
||||
//! common facade.
|
||||
|
||||
mod constants;
|
||||
|
||||
/// Crate-owned tracing target reserved for later PostgreSQL backend behavior.
|
||||
pub(crate) use self::constants::TRACING_TARGET;
|
||||
35
crates/ksp-store-postgres-lib/tests/dependency_boundary.rs
Normal file
35
crates/ksp-store-postgres-lib/tests/dependency_boundary.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
// file: crates/ksp-store-postgres-lib/tests/dependency_boundary.rs
|
||||
// version: 1
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
//! Dependency-boundary canaries for the PostgreSQL Store backend scaffold.
|
||||
|
||||
#[test]
|
||||
fn pre_002_backend_depends_on_store_api_without_reverse_facade_edge() {
|
||||
let manifest = include_str!("../Cargo.toml");
|
||||
assert!(manifest.contains("ksp-store-api = { path = \"../ksp-store-api\" }"));
|
||||
for forbidden in ["ksp-store-lib", "ksp-config-lib", "ksp-materializer", "ksp-program", "ksp-onchain-transport-lib", "ksp-offchain-transport-lib"] {
|
||||
assert!(!manifest.contains(forbidden), "forbidden PostgreSQL backend dependency detected: {forbidden}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_002_backend_does_not_advance_connection_pool_tls_or_migrations() {
|
||||
let manifest = include_str!("../Cargo.toml");
|
||||
for forbidden in ["tokio", "tokio-postgres", "deadpool-postgres", "tokio-postgres-rustls", "rustls", "sha2"] {
|
||||
assert!(!manifest.contains(forbidden), "premature PostgreSQL runtime dependency detected: {forbidden}");
|
||||
}
|
||||
let crate_root = include_str!("../src/lib.rs");
|
||||
assert!(crate_root.contains("mod constants;"));
|
||||
assert!(crate_root.contains("pub(crate) use self::constants::TRACING_TARGET;"));
|
||||
for forbidden in ["pub mod ", "pub struct", "pub enum", "pub trait", "tokio_postgres", "deadpool_postgres", "mod migration", "SELECT ", "CREATE TABLE"] {
|
||||
assert!(!crate_root.contains(forbidden), "premature PostgreSQL backend surface detected: {forbidden}");
|
||||
}
|
||||
let constants = include_str!("../src/constants.rs");
|
||||
assert!(constants.contains("pub(crate) const TRACING_TARGET: &str = \"ksp-store-postgres-lib\";"));
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user