v0.3.3-pre.006
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-store-postgres-lib/tests/dependency_boundary.rs
|
||||
// version: 10
|
||||
// version: 11
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
@@ -168,9 +168,6 @@ fn pre_005_raw_write_sql_is_atomic_idempotent_and_keeps_later_scope_closed() {
|
||||
}
|
||||
for forbidden in [
|
||||
"DELETE FROM",
|
||||
"list_raw_transactions",
|
||||
"RawPage",
|
||||
"RawCursor",
|
||||
"transition_raw_transaction_retention",
|
||||
"impl ksp_store_api::RawTransactionWrite",
|
||||
"impl ksp_store_api::RawTransactionObservationWrite",
|
||||
@@ -179,3 +176,48 @@ fn pre_005_raw_write_sql_is_atomic_idempotent_and_keeps_later_scope_closed() {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_006_raw_pagination_is_keyset_cursor_bound_and_policy_free() {
|
||||
let raw = include_str!("../src/raw_transaction.rs");
|
||||
let cursor = include_str!("../src/raw_transaction/cursor.rs");
|
||||
let index = include_str!("../migrations/v001_raw_transaction/indexes/001_ix_ksp_raw_transactions_slot_signature.sql");
|
||||
for required in [
|
||||
"LIST_TRANSACTIONS_ASC_SQL",
|
||||
"LIST_TRANSACTIONS_DESC_SQL",
|
||||
"retention_state <> 'purged'",
|
||||
"(slot, signature) >",
|
||||
"(slot, signature) <",
|
||||
"ORDER BY slot ASC, signature ASC",
|
||||
"ORDER BY slot DESC, signature DESC",
|
||||
"LIMIT $5",
|
||||
"list_raw_transactions",
|
||||
] {
|
||||
assert!(raw.contains(required), "missing pre.006 keyset pagination contract: {required}");
|
||||
}
|
||||
for required in [
|
||||
"CURSOR_BYTES: usize = 109",
|
||||
"CURSOR_MAGIC",
|
||||
"b\"KSPT\"",
|
||||
"CURSOR_VERSION: u8 = 1",
|
||||
"KSP/raw-transaction-cursor/v1",
|
||||
"sha2::Sha256",
|
||||
"query.network().as_str()",
|
||||
"query.direction()",
|
||||
"query.slots().start_inclusive()",
|
||||
"query.slots().end_inclusive()",
|
||||
"last_slot",
|
||||
"last_signature",
|
||||
"PageLimitUnsupported",
|
||||
"9_223_372_036_854_775_806",
|
||||
] {
|
||||
assert!(cursor.contains(required), "missing pre.006 cursor/binding contract: {required}");
|
||||
}
|
||||
assert!(index.contains("ON ksp_raw_transactions (slot, signature)"));
|
||||
assert!(index.contains("WHERE retention_state <> 'purged'"));
|
||||
for forbidden in [" OFFSET ", "limit.min(", "clamp(", "500", "1000", "DELETE FROM", "transition_raw_transaction_retention"] {
|
||||
assert!(!raw.contains(forbidden), "pre.006 contains forbidden pagination/policy/later-scope material: {forbidden}");
|
||||
assert!(!cursor.contains(forbidden), "pre.006 cursor contains forbidden pagination/policy/later-scope material: {forbidden}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user