lesavka/tests/manual/artifacts/probe_artifact_contract.rs

110 lines
3.9 KiB
Rust

// Contracts for manual probe artifact output.
//
// Scope: inspect manual lab scripts and summary helpers.
// Targets: scripts under `scripts/manual/`.
// Why: manual hardware probes are expensive to rerun; every run should leave
// structured JSON, readable TXT, logs, and clear missing-artifact messages.
const CLIENT_RCT_PROBE: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/scripts/manual/run_client_to_rct_transport_probe.sh"
));
const SERVER_RCT_MATRIX: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/scripts/manual/run_server_to_rc_mode_matrix.sh"
));
const GOOGLE_MEET_OBSERVER: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/scripts/manual/run_google_meet_observer_probe.sh"
));
const UVC_META_FETCH: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/scripts/manual/client_rct_uvc_frame_meta_fetch.sh"
));
const CLIENT_RCT_SUMMARY: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/scripts/manual/client_rct_transport_summary.py"
));
const CLIENT_RCT_LAYERS: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/scripts/manual/client_rct_transport_layers.py"
));
#[test]
fn client_to_rct_probe_prints_all_core_artifact_paths() {
for marker in [
"artifact_dir: ${LOCAL_REPORT_DIR}",
"capture: ${LOCAL_CAPTURE}",
"report_json: ${LOCAL_REPORT_JSON}",
"report_txt: ${LOCAL_REPORT_TXT}",
"events_csv: ${LOCAL_EVENTS_CSV}",
"client_timeline_json: ${LOCAL_CLIENT_TIMELINE_JSON}",
"clock_alignment_json: ${LOCAL_CLOCK_ALIGNMENT_JSON}",
"transport_summary_json: ${LOCAL_TRANSPORT_SUMMARY_JSON}",
"transport_summary_txt: ${LOCAL_TRANSPORT_SUMMARY_TXT}",
"upstream_sync_jsonl: ${LOCAL_UPSTREAM_SYNC_JSONL}",
"client_send_jsonl: ${LOCAL_CLIENT_SEND_JSONL}",
"run_log: ${LOCAL_RUN_LOG}",
] {
assert!(
CLIENT_RCT_PROBE.contains(marker),
"client-to-RCT probe should print artifact marker {marker}"
);
}
}
#[test]
fn server_rct_matrix_preserves_summary_json_txt_csv_and_run_log() {
for marker in [
"mode_matrix_summary_json: ${MATRIX_SUMMARY_JSON}",
"mode_matrix_summary_csv: ${MATRIX_SUMMARY_CSV}",
"mode_matrix_summary_txt: ${MATRIX_SUMMARY_TXT}",
"mode_delay_recommendations_json: ${MATRIX_DELAY_JSON}",
"mode_static_calibration_json: ${MATRIX_STATIC_JSON}",
"mode_matrix_run_log: ${MATRIX_RUN_LOG}",
"\"failure_reasons\": reasons",
"\"artifact_dir\": str(root)",
] {
assert!(
SERVER_RCT_MATRIX.contains(marker),
"server-to-RCT matrix should preserve artifact marker {marker}"
);
}
}
#[test]
fn google_meet_observer_keeps_manual_artifacts_and_optional_capture_guidance() {
for marker in [
"operator_checklist: ${OPERATOR_CHECKLIST}",
"manual_timing_json: ${MANUAL_TIMING_JSON}",
"client_timeline_json: ${CLIENT_TIMELINE_JSON}",
"LESAVKA_MEET_OBSERVER_CAPTURE",
"observer capture analysis skipped",
"Path to observer recording for analysis",
] {
assert!(
GOOGLE_MEET_OBSERVER.contains(marker),
"Google Meet observer should preserve manual artifact marker {marker}"
);
}
}
#[test]
fn missing_optional_artifacts_are_reported_clearly() {
for marker in [
"required UVC frame metadata log was unavailable",
"optional UVC frame metadata log unavailable",
"required UVC frame metadata log could not be summarized",
"optional UVC frame metadata log could not be summarized",
"freshness_bottleneck",
"evidence_incomplete",
] {
assert!(
UVC_META_FETCH.contains(marker)
|| CLIENT_RCT_SUMMARY.contains(marker)
|| CLIENT_RCT_LAYERS.contains(marker),
"manual probes should clearly explain missing/weak artifact condition {marker}"
);
}
}