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 windows_sys::Win32::{
    System::Console::GetConsoleWindow, UI::WindowsAndMessaging::IsWindowVisible,
};

const WINDOW_PROBE: &str = "platform::windows::process::console_tests::console_window_probe";
const HIDDEN: &str = "console window: hidden";

/// The desktop app has no console, so the probe runs from a detached process: the case in
/// which Windows gives a console program a window of its own.
#[test]
fn a_probe_from_a_process_without_a_console_shows_no_window() {
    let mut parent = crate::test_os::test_command(
        "platform::windows::process::console_tests::detached_parent_probe",
        &[],
    );
    let output = crate::test_os::detached_launch(parent.arg("--ignored"))
        .output()
        .unwrap();
    assert!(output.status.success(), "{output:?}");
    assert!(
        String::from_utf8_lossy(&output.stdout).contains(HIDDEN),
        "{output:?}"
    );
}

#[test]
#[ignore = "launched detached by the console window test"]
fn detached_parent_probe() {
    // SAFETY: GetConsoleWindow only reads this process's console attachment.
    assert!(
        unsafe { GetConsoleWindow() }.is_null(),
        "the parent has no console"
    );
    let exe = std::env::current_exe().unwrap();
    let stdout = crate::platform::program::tool_output(
        exe.to_str().unwrap(),
        ["--exact", WINDOW_PROBE, "--ignored", "--nocapture"].map(std::ffi::OsStr::new),
    )
    .expect("the window probe runs");
    print!("{}", String::from_utf8_lossy(&stdout));
}

#[test]
#[ignore = "launched as a host probe by the detached parent"]
fn console_window_probe() {
    // SAFETY: both calls only read; IsWindowVisible accepts a null window.
    let visible = unsafe { IsWindowVisible(GetConsoleWindow()) } != 0;
    println!(
        "console window: {}",
        if visible { "visible" } else { "hidden" }
    );
}