v0.3.6-pre.009
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
// file: crates/ksp-job-backfill-lib/tests/dependency_boundary.rs
|
||||
// version: 4
|
||||
// version: 6
|
||||
|
||||
//! Dependency firewall canaries through bounded Backfill execution/checkpointing.
|
||||
//! Dependency firewall canaries through the concrete cancellation and latest-value runtime tranche.
|
||||
|
||||
#[test]
|
||||
fn pre_008_manifest_uses_only_planned_ksp_edges_and_private_futures_runtime() {
|
||||
fn pre_009_manifest_uses_only_planned_ksp_edges_and_private_tokio_runtime() {
|
||||
let manifest = include_str!("../Cargo.toml");
|
||||
for required in [
|
||||
"futures-util = { workspace = true, features = [\"std\"] }",
|
||||
@@ -15,6 +15,7 @@ fn pre_008_manifest_uses_only_planned_ksp_edges_and_private_futures_runtime() {
|
||||
"ksp-store-lib = { path = \"../ksp-store-lib\", default-features = false }",
|
||||
"serde_json.workspace = true",
|
||||
"sha2.workspace = true",
|
||||
"tokio = { workspace = true, features = [\"macros\", \"sync\"] }",
|
||||
] {
|
||||
assert!(manifest.contains(required), "required Backfill dependency missing: {required}");
|
||||
}
|
||||
@@ -33,16 +34,13 @@ fn pre_008_manifest_uses_only_planned_ksp_edges_and_private_futures_runtime() {
|
||||
] {
|
||||
assert!(!manifest.contains(forbidden), "forbidden Backfill dependency present: {forbidden}");
|
||||
}
|
||||
let normal_dependencies = match manifest.split("[dev-dependencies]").next() {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => manifest,
|
||||
};
|
||||
assert!(!normal_dependencies.contains("tokio ="), "Tokio must not become a public/normal Backfill dependency in pre.008");
|
||||
let root = include_str!("../src/lib.rs");
|
||||
assert!(!root.contains("tokio::"), "Tokio implementation types must not leak through the public crate root");
|
||||
return;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_008_production_sources_keep_transport_store_and_scheduler_ownership_separate() {
|
||||
fn pre_009_production_sources_keep_transport_store_and_scheduler_ownership_separate() {
|
||||
let neutral_sources = [
|
||||
include_str!("../src/checkpoint.rs"),
|
||||
include_str!("../src/constants.rs"),
|
||||
@@ -50,6 +48,7 @@ fn pre_008_production_sources_keep_transport_store_and_scheduler_ownership_separ
|
||||
include_str!("../src/error.rs"),
|
||||
include_str!("../src/lib.rs"),
|
||||
include_str!("../src/request.rs"),
|
||||
include_str!("../src/runtime.rs"),
|
||||
];
|
||||
for source in neutral_sources {
|
||||
for forbidden in ["ksp_config_lib::", "ksp_interface_lib::", "ksp_store_api::", "ksp_store_postgres_lib::", "reqwest::", "std::env", "tonic::"] {
|
||||
@@ -83,5 +82,12 @@ fn pre_008_production_sources_keep_transport_store_and_scheduler_ownership_separ
|
||||
for forbidden in ["tokio::spawn", "tokio::time", "retry", "endpoint_name", "provider()", "ForceRehydrate", "get_raw_transaction"] {
|
||||
assert!(!execution.contains(forbidden), "forbidden scheduler/policy ownership detected: {forbidden}");
|
||||
}
|
||||
let runtime = include_str!("../src/runtime.rs");
|
||||
assert!(runtime.contains("tokio::sync::watch"));
|
||||
assert!(runtime.contains("JobSnapshotSource"));
|
||||
assert!(runtime.contains("JobCancellationToken"));
|
||||
assert!(!runtime.contains("tokio::spawn"));
|
||||
assert!(!runtime.contains("tokio::time"));
|
||||
assert!(!runtime.contains("reqwest::"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// file: crates/ksp-job-backfill-lib/tests/public_api.rs
|
||||
// version: 4
|
||||
// version: 6
|
||||
|
||||
//! Public API canaries through bounded Backfill execution and caller-owned checkpoints.
|
||||
//! Public API canaries through the concrete Backfill cancellation and latest-value runtime tranche.
|
||||
|
||||
#[test]
|
||||
fn pre_005_request_scope_and_discovery_contracts_are_available_from_crate_root() {
|
||||
@@ -106,3 +106,20 @@ fn pre_008_checkpoint_and_bounded_execution_contracts_are_available_from_crate_r
|
||||
assert_eq!(ksp_job_backfill_lib::ERROR_CODE_BACKFILL_EXECUTION_INVALID, ksp_core_lib::ErrorCode::new("job_backfill", "execution_invalid"));
|
||||
return;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_009_concrete_runtime_snapshot_and_control_contracts_are_available_from_crate_root() {
|
||||
fn assert_source<T>()
|
||||
where
|
||||
T: ksp_job_api::JobSnapshotSource<Snapshot = ksp_job_backfill_lib::BackfillJobSnapshot>,
|
||||
{
|
||||
return;
|
||||
}
|
||||
assert_source::<ksp_job_backfill_lib::BackfillSnapshotSource>();
|
||||
let _runtime_new = ksp_job_backfill_lib::BackfillJobRuntime::new;
|
||||
let _handle: std::option::Option<ksp_job_backfill_lib::BackfillJobHandle> = std::option::Option::None;
|
||||
let _phase = ksp_job_backfill_lib::BackfillJobPhase::Discovering;
|
||||
assert_eq!(ksp_job_backfill_lib::BACKFILL_JOB_KIND_CODE, "solana.raw_transaction.backfill");
|
||||
assert_eq!(ksp_job_backfill_lib::ERROR_CODE_BACKFILL_RUNTIME_INVALID, ksp_core_lib::ErrorCode::new("job_backfill", "runtime_invalid"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// file: crates/ksp-job-backfill-lib/tests/release_completeness.rs
|
||||
// version: 4
|
||||
// version: 7
|
||||
|
||||
//! Completeness canaries through the `pre.008` bounded execution/checkpoint tranche.
|
||||
//! Completeness canaries through the `pre.009` concrete cancellation and latest-value runtime tranche.
|
||||
|
||||
#[test]
|
||||
fn pre_008_production_module_inventory_is_exact() -> std::io::Result<()> {
|
||||
fn pre_009_production_module_inventory_is_exact() -> std::io::Result<()> {
|
||||
let source_root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
|
||||
let entries = match std::fs::read_dir(source_root) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
@@ -34,13 +34,24 @@ fn pre_008_production_module_inventory_is_exact() -> std::io::Result<()> {
|
||||
names.sort_unstable();
|
||||
assert_eq!(
|
||||
names,
|
||||
std::vec!["checkpoint.rs", "constants.rs", "conversion.rs", "discovery.rs", "error.rs", "execution.rs", "lib.rs", "persistence.rs", "request.rs"]
|
||||
std::vec![
|
||||
"checkpoint.rs",
|
||||
"constants.rs",
|
||||
"conversion.rs",
|
||||
"discovery.rs",
|
||||
"error.rs",
|
||||
"execution.rs",
|
||||
"lib.rs",
|
||||
"persistence.rs",
|
||||
"request.rs",
|
||||
"runtime.rs",
|
||||
]
|
||||
);
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_008_surface_adds_bounded_execution_and_checkpoint_without_pre_009_runtime() {
|
||||
fn pre_009_surface_closes_concrete_cancellation_and_latest_value_runtime() {
|
||||
let root = include_str!("../src/lib.rs");
|
||||
for required in [
|
||||
"BackfillCandidate",
|
||||
@@ -65,11 +76,18 @@ fn pre_008_surface_adds_bounded_execution_and_checkpoint_without_pre_009_runtime
|
||||
"execute_backfill_discovery",
|
||||
"ERROR_CODE_BACKFILL_CHECKPOINT_INVALID",
|
||||
"ERROR_CODE_BACKFILL_EXECUTION_INVALID",
|
||||
"BackfillJobHandle",
|
||||
"BackfillJobPhase",
|
||||
"BackfillJobRuntime",
|
||||
"BackfillJobSnapshot",
|
||||
"BackfillSnapshotSource",
|
||||
"BACKFILL_JOB_KIND_CODE",
|
||||
"ERROR_CODE_BACKFILL_RUNTIME_INVALID",
|
||||
] {
|
||||
assert!(root.contains(required), "required pre.008 public contract missing: {required}");
|
||||
assert!(root.contains(required), "required pre.009 public contract missing: {required}");
|
||||
}
|
||||
for forbidden in ["BackfillJobHandle", "BackfillSnapshot", "JobSnapshotSource", "tokio::", "FuturesUnordered"] {
|
||||
assert!(!root.contains(forbidden), "pre.009 or runtime implementation detail leaked into public root: {forbidden}");
|
||||
for forbidden in ["tokio::", "FuturesUnordered", "watch::Receiver", "watch::Sender"] {
|
||||
assert!(!root.contains(forbidden), "runtime implementation detail leaked into public root: {forbidden}");
|
||||
}
|
||||
assert!(!root.contains("pub mod "));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user