0.3.15-pre.012-fix.001
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-raw-transaction-ingest-desk/src/route_runtime.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
//! Multi-route Store and independent Worker lifecycle owned by Raw Transaction Ingest Desk.
|
||||
|
||||
@@ -544,12 +544,35 @@ impl crate::RouteRuntimeLaunch {
|
||||
/// Waits for this Worker terminal state, removes only its route and closes Store only after the final same-network route terminates.
|
||||
pub(crate) async fn monitor(self) {
|
||||
let terminal = self.handle.wait_terminal().await;
|
||||
let snapshot = self.handle.snapshot_source().current();
|
||||
let worker = snapshot.worker_snapshot();
|
||||
let snapshot_fault = worker.state().fault_code();
|
||||
let snapshot_fault_domain = snapshot_fault.map_or("none", |code| return code.domain());
|
||||
let snapshot_fault_code = snapshot_fault.map_or("none", |code| return code.code());
|
||||
let terminal_state = match terminal {
|
||||
std::result::Result::Ok(state) => {
|
||||
ksp_logging_lib::info!(
|
||||
target: crate::TRACING_TARGET,
|
||||
domain = crate::TRACING_DOMAIN_ROUTE_RUNTIME,
|
||||
profile_id = self.acknowledgement.profile_id.as_str(),
|
||||
network = self.acknowledgement.network.as_str(),
|
||||
route_id = self.acknowledgement.route_id.as_str(),
|
||||
commitment = self.acknowledgement.commitment.as_str(),
|
||||
worker_state = state.code(),
|
||||
worker_health = worker.health().code(),
|
||||
worker_activity = worker.activity().code(),
|
||||
fault_domain = snapshot_fault_domain,
|
||||
fault_code = snapshot_fault_code,
|
||||
source_failure_total = snapshot.source_failure_total(),
|
||||
store_failure_total = snapshot.store_failure_total(),
|
||||
content_conflict_total = snapshot.content_conflict_total(),
|
||||
source_active = snapshot.source_active(),
|
||||
source_reconnecting = snapshot.source_reconnecting(),
|
||||
source_failed = snapshot.source_failed(),
|
||||
open_gap_count = snapshot.open_gap_count(),
|
||||
continuity_has_open_gaps = snapshot.continuity_has_open_gaps(),
|
||||
future_target_coverage = snapshot.future_target_coverage(),
|
||||
failed_source_losses_reconciled = snapshot.failed_source_losses_reconciled(),
|
||||
"Raw Transaction Ingest Desk route Worker reached terminal state"
|
||||
);
|
||||
project_worker_state(state)
|
||||
@@ -558,8 +581,18 @@ impl crate::RouteRuntimeLaunch {
|
||||
ksp_logging_lib::warn!(
|
||||
target: crate::TRACING_TARGET,
|
||||
domain = crate::TRACING_DOMAIN_ROUTE_RUNTIME,
|
||||
profile_id = self.acknowledgement.profile_id.as_str(),
|
||||
network = self.acknowledgement.network.as_str(),
|
||||
route_id = self.acknowledgement.route_id.as_str(),
|
||||
commitment = self.acknowledgement.commitment.as_str(),
|
||||
error_domain = error.code().domain(),
|
||||
error_code = error.code().code(),
|
||||
worker_health = worker.health().code(),
|
||||
snapshot_fault_domain = snapshot_fault_domain,
|
||||
snapshot_fault_code = snapshot_fault_code,
|
||||
source_failure_total = snapshot.source_failure_total(),
|
||||
store_failure_total = snapshot.store_failure_total(),
|
||||
content_conflict_total = snapshot.content_conflict_total(),
|
||||
"Raw Transaction Ingest Desk terminal Worker wait failed"
|
||||
);
|
||||
crate::RawIngestRouteState::Faulted
|
||||
@@ -567,7 +600,6 @@ impl crate::RouteRuntimeLaunch {
|
||||
};
|
||||
let mut terminal = self.acknowledgement;
|
||||
terminal.state = terminal_state;
|
||||
let snapshot = self.handle.snapshot_source().current();
|
||||
let monitoring = crate::project_route_monitoring(&terminal, &snapshot);
|
||||
let monitoring = match monitoring {
|
||||
std::result::Result::Ok(value) => std::option::Option::Some(value),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-raw-transaction-ingest-desk/tests/desktop_contract.rs
|
||||
// version: 11
|
||||
// version: 12
|
||||
|
||||
//! Desktop scaffold contract canaries for Raw Transaction Ingest Desk.
|
||||
|
||||
@@ -308,3 +308,42 @@ fn pre_012_window_shutdown_and_start_stop_races_are_bounded_backend_owned() {
|
||||
assert!(!app_state.contains("std::mem::drop(generation)"));
|
||||
assert!(app_state.contains("self.route_runtime.ensure_start_admission_open()"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_012_fix_002_terminal_fault_logging_keeps_safe_route_identity_and_worker_cause_counters() {
|
||||
let runtime = read_text(app_root().join("src/route_runtime.rs").as_path());
|
||||
let start = runtime.find("pub(crate) async fn monitor(self)");
|
||||
let start = match start {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => {
|
||||
assert!(false, "missing RouteRuntimeLaunch::monitor");
|
||||
return;
|
||||
},
|
||||
};
|
||||
let remainder = &runtime[start..];
|
||||
let end = remainder.find("/// Starts one exact route Worker");
|
||||
let end = match end {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => {
|
||||
assert!(false, "missing route runtime monitor end marker");
|
||||
return;
|
||||
},
|
||||
};
|
||||
let monitor = &remainder[..end];
|
||||
for required in [
|
||||
"worker_health = worker.health().code()",
|
||||
"fault_domain = snapshot_fault_domain",
|
||||
"fault_code = snapshot_fault_code",
|
||||
"source_failure_total = snapshot.source_failure_total()",
|
||||
"store_failure_total = snapshot.store_failure_total()",
|
||||
"content_conflict_total = snapshot.content_conflict_total()",
|
||||
"open_gap_count = snapshot.open_gap_count()",
|
||||
"future_target_coverage = snapshot.future_target_coverage()",
|
||||
"failed_source_losses_reconciled = snapshot.failed_source_losses_reconciled()",
|
||||
] {
|
||||
assert!(monitor.contains(required), "missing pre.012-fix.002 terminal diagnostic marker {required}");
|
||||
}
|
||||
for forbidden in ["endpoint_url", "connection_uri", "api_key", "source_key", "worker_id", "signature", "canonical_bytes", "wire_bytes"] {
|
||||
assert!(!monitor.contains(forbidden), "terminal diagnostic surface exposes forbidden marker {forbidden}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user