generated from coulomb/repo-seed
64 lines
2.0 KiB
Python
64 lines
2.0 KiB
Python
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
|
|
|
|
def _load_script():
|
|
path = Path(__file__).parent.parent / "scripts" / "verify_daily_triage.py"
|
|
spec = importlib.util.spec_from_file_location("verify_daily_triage", path)
|
|
assert spec is not None
|
|
module = importlib.util.module_from_spec(spec)
|
|
assert spec.loader is not None
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
def test_daily_triage_verifier_dry_run_names_all_operator_checks() -> None:
|
|
script = _load_script()
|
|
args = script.parse_args([
|
|
"--activity-id",
|
|
"00000000-0000-0000-0000-000000000123",
|
|
"--date",
|
|
"2026-06-04",
|
|
"--working-memory-dir",
|
|
"/tmp/wm",
|
|
])
|
|
|
|
report = script.build_dry_run_report(args)
|
|
|
|
assert report["mode"] == "dry-run"
|
|
names = {check["name"] for check in report["checks"]}
|
|
assert names == {
|
|
"temporal_schedule",
|
|
"latest_workflow_history",
|
|
"activity_runs_row",
|
|
"state_hub_progress",
|
|
"working_memory_note",
|
|
"llm_timeout_budget",
|
|
}
|
|
assert report["activity"]["schedule_id"] == (
|
|
"activity-schedule-00000000-0000-0000-0000-000000000123"
|
|
)
|
|
assert any(
|
|
check.get("path_glob") == "/tmp/wm/daily-triage-2026-06-04-*.md"
|
|
for check in report["checks"]
|
|
)
|
|
timeout_check = next(
|
|
check for check in report["checks"] if check["name"] == "llm_timeout_budget"
|
|
)
|
|
run_check = next(
|
|
check for check in report["checks"] if check["name"] == "activity_runs_row"
|
|
)
|
|
assert "activity_runs.activity_id" in run_check["sql"]
|
|
assert "where id = '00000000-0000-0000-0000-000000000123'" in timeout_check["sql"]
|
|
assert timeout_check["activity_timeout_seconds"] == 900
|
|
assert timeout_check["retry_attempts"] == 10
|
|
|
|
|
|
def test_daily_triage_verifier_default_working_memory_dir() -> None:
|
|
script = _load_script()
|
|
args = script.parse_args([])
|
|
|
|
assert args.working_memory_dir == "/home/worsch/the-custodian/memory/working"
|