Files
timmy-config/tests/test_ops_status_packet.py
Alexander Payne 00c322595f
Some checks failed
Architecture Lint / Linter Tests (pull_request) Successful in 22s
Smoke Test / smoke (pull_request) Failing after 25s
Validate Config / YAML Lint (pull_request) Failing after 16s
Validate Config / JSON Validate (pull_request) Successful in 23s
Validate Config / Python Syntax & Import Check (pull_request) Failing after 1m6s
Validate Config / Python Test Suite (pull_request) Has been skipped
Validate Config / Cron Syntax Check (pull_request) Successful in 17s
Validate Config / Shell Script Lint (pull_request) Failing after 1m10s
Validate Config / Deploy Script Dry Run (pull_request) Successful in 11s
Validate Config / Playbook Schema Validation (pull_request) Successful in 13s
Architecture Lint / Lint Repository (pull_request) Failing after 8s
PR Checklist / pr-checklist (pull_request) Successful in 3m49s
feat: add canonical ops status packet — truth pass
Add ops-status-packet.py (reusable generator) and ops-status-template.md.
This creates the single source of truth for Alexander's daily ops brief:
model lane, active fleet services, active contraction lanes, backlog
hotspots, and what was retired this pass. Replaces scattered status
fragments — one packet to rule them all.

Also fix stale VISION_MODEL reference in glitch-detection.md (gpt-4o
→ qwen3:30b) to keep model naming consistent across docs.

Closes #882
2026-04-29 07:34:01 -04:00

71 lines
2.4 KiB
Python

"""Smoke tests for ops-status-packet.py — canonical ops truth pass."""
from pathlib import Path
import os
import subprocess
import json
import sys
ROOT = Path(__file__).resolve().parent.parent
SCRIPT_PATH = ROOT / "scripts" / "ops-status-packet.py"
DOC_PATH = ROOT / "docs" / "ops-status-template.md"
def test_script_exists_and_is_executable():
assert SCRIPT_PATH.exists(), "missing ops-status-packet.py"
# Not checking executable bit (scripts may rely on python3 invocation)
def test_template_doc_exists():
assert DOC_PATH.exists(), "missing ops-status-template.md"
content = DOC_PATH.read_text(encoding="utf-8")
assert "Canonical Ops Truth Packet" in content
assert "Model lane:" in content or "model lane" in content.lower()
def test_json_output_is_valid():
env = os.environ.copy()
token_path = Path.home() / ".config" / "gitea" / "token"
if token_path.exists():
env["GITEA_TOKEN"] = token_path.read_text().strip()
result = subprocess.run(
[sys.executable, str(SCRIPT_PATH), "--json"],
capture_output=True, text=True, timeout=30, env=env,
)
assert result.returncode == 0, f"script failed: {result.stderr[:200]}"
data = json.loads(result.stdout)
assert "generated" in data
assert "model_lane" in data
assert "services" in data
assert "active_contraction_lanes" in data
assert "backlog_hotspots" in data
assert "closed_recent" in data
assert "retired" in data
assert "next_target" in data
# Model lane should include provider/model
assert "/" in data["model_lane"]
assert len(data["active_contraction_lanes"]) >= 4
def test_markdown_output_contains_required_sections():
env = os.environ.copy()
token_path = Path.home() / ".config" / "gitea" / "token"
if token_path.exists():
env["GITEA_TOKEN"] = token_path.read_text().strip()
result = subprocess.run(
[sys.executable, str(SCRIPT_PATH)],
capture_output=True, text=True, timeout=30, env=env,
)
assert result.returncode == 0
md = result.stdout
assert "# Ops Truth Packet —" in md
assert "**Model lane:**" in md
assert "**Services kept:**" in md
assert "**Active contraction lanes:**" in md
assert "## Backlog hotspots" in md
assert "## Closed this pass" in md
assert "## Retired this pass" in md
assert "## Blockers" in md
assert "## Next contraction target" in md