//! SemVer-compat regression tests for klieo-core 0.2 minor bumps.
//!
//! These tests pin the "additive only" contract for ADR-008: existing
//! downstream code must continue to compile after the bump.

use async_trait::async_trait;
use klieo_core::memory::Episode;
use klieo_core::tool::Tool;
use klieo_core::{ToolCtx, ToolError};

#[test]
fn episode_match_with_only_wildcard_arm_compiles() {
    let event = Episode::Started { agent: "x".into() };
    // Load-bearing claim is compile-time: a new Episode variant must not
    // silently break downstream wildcard exhaustive matches.
    let label: &str = {
        let _ = event;
        "any"
    };
    assert_eq!(label, "any");
}

struct NoOverrideTool;

#[async_trait]
impl Tool for NoOverrideTool {
    fn name(&self) -> &str {
        "noop"
    }
    fn description(&self) -> &str {
        ""
    }
    fn json_schema(&self) -> &serde_json::Value {
        static S: std::sync::OnceLock<serde_json::Value> = std::sync::OnceLock::new();
        S.get_or_init(|| serde_json::json!({"type": "object"}))
    }
    async fn invoke(
        &self,
        args: serde_json::Value,
        _ctx: ToolCtx,
    ) -> Result<serde_json::Value, ToolError> {
        Ok(args)
    }
    // intentionally does NOT override is_effectful
}

#[test]
fn tool_without_is_effectful_override_returns_false() {
    assert!(!NoOverrideTool.is_effectful());
}
