use iknowyou_engine::run_pg1_eval;

#[test]
fn pg1_metrics_meet_floor() {
    let dir = tempfile::tempdir().expect("tempdir");
    let metrics = run_pg1_eval(dir.path()).expect("pg1 eval should run");

    assert!(
        metrics.hard_negative_leak_rate <= 0.0,
        "hard negatives leaked: {:?}",
        metrics
    );

    // This runs entirely in-process on local storage; adaptation should be immediate.
    assert!(
        metrics.adaptation_p95_ms <= 200,
        "adaptation p95 too high: {:?}",
        metrics
    );

    assert!(
        metrics.useful_item_uplift > 0.0,
        "expected useful-item uplift over baseline: {:?}",
        metrics
    );

    assert!(
        metrics.repeated_unwanted_rate <= 0.01,
        "unwanted items repeated too often: {:?}",
        metrics
    );
}
