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 serde_json::json;

#[test]
fn provisional_constructor_rejects_red_and_preserves_green_evidence_when_promoted() {
    let red = ExecutionResult::try_from(
        json!({"verdict":"RED","kind":"human","issues":[{"reason":"failed"}]}),
    )
    .unwrap();
    assert!(GreenResult::try_from(red).is_err());
    let expected =
        json!({"verdict":"GREEN","kind":"agent","issues":[{"priority":"P3","reason":"a nit"}]});
    let green = ExecutionResult::try_from(expected.clone()).unwrap();
    let provisional = RequestState::Provisional {
        result: green.try_into().unwrap(),
        at: "2026-01-01T00:00:00Z".parse().unwrap(),
    };
    assert_eq!(provisional.status(), RequestStatus::Provisional);
    assert_eq!(provisional.result().unwrap().to_json(), expected);
    let execution = ExecutionState::try_from(provisional).unwrap();
    assert_eq!(execution.status(), ExecutionStatus::Green);
    assert_eq!(execution.result().unwrap().to_json(), expected);
}