40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
def test_session_has_state_snapshot_and_status_contract() -> None:
|
|
model_path = (
|
|
Path(__file__).resolve().parents[3] / "src" / "models" / "agent_chat_session.py"
|
|
)
|
|
content = model_path.read_text(encoding="utf-8")
|
|
|
|
assert "state_snapshot" in content
|
|
assert "AgentChatSessionStatus" in content
|
|
|
|
|
|
def test_message_has_token_cost_and_metadata_contract() -> None:
|
|
model_path = (
|
|
Path(__file__).resolve().parents[3] / "src" / "models" / "agent_chat_message.py"
|
|
)
|
|
content = model_path.read_text(encoding="utf-8")
|
|
|
|
assert "input_tokens" in content
|
|
assert "output_tokens" in content
|
|
assert "cost" in content
|
|
assert '"metadata"' in content
|
|
|
|
versions_dir = Path(__file__).resolve().parents[3] / "alembic" / "versions"
|
|
migration_file = versions_dir / "20260305_agent_runtime_closed_loop_contract.py"
|
|
assert migration_file.exists()
|
|
|
|
|
|
def test_message_currency_removal_migration_contract() -> None:
|
|
versions_dir = Path(__file__).resolve().parents[3] / "alembic" / "versions"
|
|
migration_file = versions_dir / "20260306_0002_drop_message_currency.py"
|
|
assert migration_file.exists()
|
|
|
|
content = migration_file.read_text(encoding="utf-8")
|
|
assert "drop_column(\"messages\", \"currency\")" in content
|
|
assert "Irreversible migration" in content
|