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::*;

const HANGUP_PROBE: &str = "ARTIFACTIZE_TEST_TERMINAL_HANGUP";

#[test]
fn terminal_hangup_completes_the_portable_stop_future() {
    // Isolate the signal so a missing subscription cannot terminate the test runner.
    let mut child = crate::test_os::test_command(
        "platform::unix::tests::terminal_hangup_probe",
        &[(HANGUP_PROBE, "1".into())],
    );
    let output = crate::test_os::finish(crate::test_os::start(&mut child), "terminal hangup probe");
    assert!(output.status.success(), "{output:?}");
}

#[tokio::test]
async fn terminal_hangup_probe() {
    if std::env::var_os(HANGUP_PROBE).is_none() {
        return;
    }
    let stop = stop_requested().unwrap();
    // SIGHUP is Unix-specific; the portable interrupt also has a cross-OS seam test.
    crate::test_os::hangup_self();
    stop.await;
}

/// Unlike Windows, no error here is ever transient in this sense; the predicate is a
/// permanent no-op, not a gap in detecting a race that would need retrying.
#[test]
fn transient_file_access_is_always_false() {
    assert!(!transient_file_access(&io::Error::from_raw_os_error(5)));
    assert!(!transient_file_access(&io::Error::new(
        io::ErrorKind::PermissionDenied,
        "permission denied"
    )));
}