local-review.yml (push) Invalid workflow file
Auto-version and Release / release (push) Successful in 11s
CI Pipeline / lint (push) Failing after 30s
CI Pipeline / go-surface (push) Failing after 19s
CI Pipeline / rust-surface (push) Successful in 4m19s
CI Pipeline / unit-tests (push) Failing after 5m21s
CI Pipeline / best-practices (push) Successful in 7s
CI Pipeline / documentation (push) Successful in 7s
CI Pipeline / canary (push) Successful in 1m4s
CI Pipeline / type-check (push) Failing after 35s
CI Pipeline / gitea-offline (push) Successful in 20s
deploy / deploy (push) Failing after 15m11s
CI Pipeline / required-checks (push) Failing after 1s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Successful in 10s
- inference_paths.py: all 16 outbound model-call sites enumerated (approval-resume, compaction, 11 side paths, 3 embed sites, 1 documented exclusion); trace_side_path records side-path inference as its own trace record (journaled when the journal is available) - the census test asserts grep-completeness: any new raw call site fails the build until it joins the census - approval-resume is TRACED (not excluded); the TUI warmup is the single documented exclusion (no task linkage, no user output) 6/6 green. #145 closed with evidence.
67 lines
2.4 KiB
Python
67 lines
2.4 KiB
Python
"""test_inference_paths.py — #145: the census is complete and the
|
|
trace wiring holds."""
|
|
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
REPO = Path(__file__).resolve().parent.parent
|
|
sys.path.insert(0, str(REPO / "src"))
|
|
sys.path.insert(0, str(REPO / "src" / "rune"))
|
|
|
|
import inference_paths as ip # noqa: E402
|
|
|
|
|
|
class TestCensusCompleteness:
|
|
def test_census_covers_every_grep_hit(self):
|
|
"""The census must name every module with a raw outbound call."""
|
|
r = subprocess.run(
|
|
["grep", "-rn", "/api/generate", "src/rune/", "--include=*.py",
|
|
"-l"],
|
|
capture_output=True, text=True, cwd=REPO)
|
|
modules = {Path(f).stem for f in r.stdout.splitlines()
|
|
if "test" not in f}
|
|
census_modules = {m for m, _f, _e, _k, _n in ip.CENSUS}
|
|
missing = (modules - census_modules
|
|
- {"inference_trace", "inference_paths"})
|
|
assert not missing, f"untraced modules: {missing}"
|
|
|
|
def test_embed_sites_covered(self):
|
|
r = subprocess.run(
|
|
["grep", "-rn", "/api/embed", "src/rune/", "--include=*.py",
|
|
"-l"],
|
|
capture_output=True, text=True, cwd=REPO)
|
|
modules = {Path(f).stem for f in r.stdout.splitlines()
|
|
if "test" not in f}
|
|
census_modules = {m for m, _f, _e, _k, _n in ip.CENSUS}
|
|
missing = modules - census_modules - {"inference_paths"}
|
|
assert not missing, f"untraced embed modules: {missing}"
|
|
|
|
|
|
class TestTraceWiring:
|
|
def test_side_path_record_shape(self):
|
|
r = ip.trace_side_path("goal", "_goal", model="m",
|
|
task_id="t1", duration_ms=12.5)
|
|
assert r["kind"] == "side_path"
|
|
assert r["module"] == "goal"
|
|
assert r["task_id"] == "t1"
|
|
assert "at" in r
|
|
assert isinstance(r["journaled"], bool)
|
|
|
|
def test_approval_resume_is_traced_not_excluded(self):
|
|
kinds = {m: k for m, _f, _e, k, _n in ip.CENSUS}
|
|
assert kinds.get("rune_operator") == "APPROVAL"
|
|
|
|
def test_exclusions_have_reasons(self):
|
|
for m, f, e, k, note in ip.CENSUS:
|
|
if k == "EXCLUDED":
|
|
assert note and len(note) > 20, f"{m}.{f} exclusion needs a reason"
|
|
|
|
def test_report_counts(self):
|
|
rep = ip.census_report()
|
|
assert rep["total"] == len(ip.CENSUS)
|
|
assert sum(rep["by_kind"].values()) == len(ip.CENSUS)
|