rho-coding-agent 2.11.0

A fast Rust agent harness with a small footprint and opinionated defaults
use super::*;
use rho_providers::model::ReasoningLevelSet;

fn exact() -> ReasoningCapabilities {
    ReasoningCapabilities::Levels(ReasoningLevelSet::new(vec![
        ReasoningLevel::Low,
        ReasoningLevel::High,
    ]))
}

#[test]
fn explicit_change_during_fetch_is_rejected_and_restored() {
    let resolved = resolve_fetched_reasoning(
        &exact(),
        ReasoningLevel::Medium,
        Some((
            ReasoningLevel::Low,
            ReasoningRequestSource::PersistedOrDefault,
        )),
    );

    assert_eq!(resolved.effective, ReasoningLevel::Low);
    assert_eq!(resolved.rejected, Some(ReasoningLevel::Medium));
}

#[test]
fn initial_explicit_value_remains_explicit_when_metadata_arrives() {
    let resolved = resolve_fetched_reasoning(
        &exact(),
        ReasoningLevel::Medium,
        Some((ReasoningLevel::Medium, ReasoningRequestSource::Explicit)),
    );

    assert_eq!(resolved.effective, ReasoningLevel::High);
    assert_eq!(resolved.rejected, Some(ReasoningLevel::Medium));
}

#[test]
fn unchanged_persisted_value_is_normalized_after_fetch() {
    let resolved = resolve_fetched_reasoning(
        &exact(),
        ReasoningLevel::Medium,
        Some((
            ReasoningLevel::Medium,
            ReasoningRequestSource::PersistedOrDefault,
        )),
    );

    assert_eq!(resolved.effective, ReasoningLevel::High);
    assert_eq!(resolved.rejected, None);
}

#[test]
fn fixed_models_retain_the_global_reasoning_preference() {
    let resolved = resolve_fetched_reasoning(
        &ReasoningCapabilities::NotConfigurable,
        ReasoningLevel::High,
        Some((
            ReasoningLevel::High,
            ReasoningRequestSource::PersistedOrDefault,
        )),
    );

    assert_eq!(resolved.effective, ReasoningLevel::High);
    assert_eq!(resolved.rejected, None);
}