// Manual Google Meet observer contract.
//
// Scope: protect the operator-assisted Google Meet observer harness and its
// optional recording analysis path.
// Targets: scripts/manual/run_google_meet_observer_probe.sh.
// Why: Meet is a real-world consumer of the RCT UVC/UAC output, but the test
// must stay manual, artifact-backed, and free of browser credential automation.

const GOOGLE_MEET_OBSERVER_SCRIPT: &str = include_str!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/scripts/manual/run_google_meet_observer_probe.sh"
));

#[test]
fn google_meet_observer_stays_manual_and_artifact_backed() {
    for marker in [
        "Google Meet observer probe checklist",
        "no Google credentials, sudo, or browser automation are used",
        "operator-checklist.txt",
        "manual-timing.json",
        "client-transport-timeline.json",
        "LESAVKA_MEET_OBSERVER_CAPTURE=${LESAVKA_MEET_OBSERVER_CAPTURE:-}",
        "observer-google-meet-capture",
        "Observer capture times are operator-confirmed",
        "Path to observer recording for analysis (blank to skip)",
    ] {
        assert!(
            GOOGLE_MEET_OBSERVER_SCRIPT.contains(marker),
            "Google Meet observer harness should preserve marker {marker}"
        );
    }
}

#[test]
fn google_meet_observer_uses_synthetic_bundled_media_without_secret_automation() {
    for marker in [
        "lesavka-sync-probe",
        "--event-width-codes \"${PROBE_EVENT_WIDTH_CODES}\"",
        "--timeline-json \"${CLIENT_TIMELINE_JSON}\"",
        "running synthetic bundled media through Google Meet path",
        "lesavka-sync-analyze",
    ] {
        assert!(
            GOOGLE_MEET_OBSERVER_SCRIPT.contains(marker),
            "Google Meet observer harness should preserve synthetic marker {marker}"
        );
    }

    for forbidden in [
        "chromedriver",
        "geckodriver",
        "google-chrome --remote-debugging",
        "sudo ",
        "PASSWORD",
        "VAULT",
        "vault",
        "read -s",
    ] {
        assert!(
            !GOOGLE_MEET_OBSERVER_SCRIPT.contains(forbidden),
            "Google Meet observer harness must remain manual/non-secret: {forbidden}"
        );
    }
}
