artifactize-core 0.27.0

The library behind artifactize: Artifacts, evals, reviews, the monitor and review models, and the shared operations every interface calls.
Documentation
use super::*;
use std::{path::PathBuf, time::Duration};

const READY: &str = "ARTIFACTIZE_TEST_STOP_PROBE_READY";
const WATCHDOG: Duration = Duration::from_secs(15);

#[tokio::test]
async fn a_terminal_interrupt_completes_stop_requested() {
    let root = crate::test_os::tempdir();
    let ready = root.path().join("ready");
    let mut child = crate::test_os::test_command(
        "platform::stop_tests::terminal_interrupt_probe",
        &[(READY, ready.clone().into_os_string())],
    );
    crate::test_os::new_group(&mut child);
    let mut child = crate::test_os::spawn_test(&mut tokio::process::Command::from(child));
    crate::test_os::wait_until(WATCHDOG, || ready.is_file());
    crate::test_os::interrupt(child.id());
    assert!(child.wait().await.success());
}

#[tokio::test]
async fn terminal_interrupt_probe() {
    let Some(ready) = crate::test_os::environment_variable(READY) else {
        return;
    };
    let stop = stop_requested().unwrap();
    std::fs::write(PathBuf::from(ready), "subscribed").unwrap();
    stop.await;
}