Files
openclaw-mission-control/backend/tests/test_template_size_budget.py
Abhimanyu Saharan a55664810c refactor(constants): initialize LEAD_TEMPLATE_MAP as an empty dictionary
refactor(page): clean up import statements for better readability
fix(tests): update assertions for clarity and consistency
2026-02-15 00:53:27 +05:30

20 lines
656 B
Python

# ruff: noqa: S101
"""Template size guardrails for injected heartbeat context."""
from __future__ import annotations
from pathlib import Path
HEARTBEAT_CONTEXT_LIMIT = 20_000
TEMPLATES_DIR = Path(__file__).resolve().parents[1] / "templates"
def test_heartbeat_templates_fit_in_injected_context_limit() -> None:
"""Heartbeat templates must stay under gateway injected-context truncation limit."""
targets = ("BOARD_HEARTBEAT.md.j2",)
for name in targets:
size = (TEMPLATES_DIR / name).stat().st_size
assert (
size <= HEARTBEAT_CONTEXT_LIMIT
), f"{name} is {size} chars (limit {HEARTBEAT_CONTEXT_LIMIT})"