feat: harden seat intent and expand HIL coverage

This commit is contained in:
vee
2026-08-02 05:20:38 +08:00
parent 4aded5c21d
commit 55d0d400cb
62 changed files with 53112 additions and 1748 deletions
+46
View File
@@ -0,0 +1,46 @@
from __future__ import annotations
import os
import tempfile
import unittest
from pathlib import Path
from unittest.mock import patch
from cognitive_agent.config_loader import load_local_env
class LocalEnvironmentLoaderTests(unittest.TestCase):
def test_file_replaces_blank_inherited_value_but_preserves_non_blank_override(self) -> None:
with tempfile.TemporaryDirectory() as directory:
path = Path(directory) / ".env"
path.write_text(
"OPENAI_MODEL=gpt-5.6-sol\nOPENAI_BASE_URL=https://configured.example/v1\n",
encoding="utf-8",
)
with patch.dict(
os.environ,
{
"OPENAI_MODEL": "",
"OPENAI_BASE_URL": "https://explicit.example/v1",
},
clear=True,
):
load_local_env(path)
self.assertEqual(os.environ["OPENAI_MODEL"], "gpt-5.6-sol")
self.assertEqual(
os.environ["OPENAI_BASE_URL"], "https://explicit.example/v1"
)
def test_explicit_override_replaces_stale_non_blank_launcher_value(self) -> None:
with tempfile.TemporaryDirectory() as directory:
path = Path(directory) / ".env"
path.write_text("OPENAI_MODEL=gpt-5.6-sol\n", encoding="utf-8")
with patch.dict(
os.environ, {"OPENAI_MODEL": "gpt-5-mini"}, clear=True
):
load_local_env(path, override=True)
self.assertEqual(os.environ["OPENAI_MODEL"], "gpt-5.6-sol")
if __name__ == "__main__":
unittest.main()