teleo-infrastructure/tests/test_repo_skill_pack.py

115 lines
4.1 KiB
Python

from __future__ import annotations
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
REPORT_DIR = ROOT / "docs" / "reports" / "leo-working-state-20260709"
MANIFEST = REPORT_DIR / "skill-pack-manifest.json"
def _skill(name: str) -> str:
return (ROOT / ".agents" / "skills" / name / "SKILL.md").read_text(
encoding="utf-8"
)
def test_manifest_indexes_valid_repo_native_skills() -> None:
manifest = json.loads(MANIFEST.read_text(encoding="utf-8"))
assert manifest["status"] == "repo_native_validated"
assert manifest["repo_skill_root"] == ".agents/skills"
assert manifest["validation"] == "tests/test_repo_skill_pack.py"
assert "37/37" in manifest["claim_ceiling"]
assert "auto-synchronized" in manifest["claim_ceiling"]
assert "apply worker remained disabled/inactive" in manifest["claim_ceiling"]
for entry in manifest["skills"]:
path = ROOT / entry["path"]
text = path.read_text(encoding="utf-8")
assert path.is_file()
assert text.startswith("---\n")
assert f"name: {entry['name']}\n" in text.split("---\n", 2)[1]
assert "description:" in text.split("---\n", 2)[1]
for relative in manifest["reference_files"]:
assert (ROOT / relative).is_file(), relative
def test_db_change_skill_tracks_guarded_v2_runtime_proof() -> None:
text = _skill("teleo-kb-db-change-workflow")
squashed = " ".join(text.split())
for required in (
"`approve_claim` v2",
"kb_review",
"kb_apply",
"kb_gate_owner",
"NOINHERIT",
"37/37",
"exact table deltas",
"source hashes",
"trusted operator-only canonical writer",
"run_approve_claim_isolated_container_canary.sh",
"all `13` checks",
"`34/34`",
"PR #86",
):
assert required in text
assert "Production was not applied" in squashed
assert "Arbitrary production document/tweet ingestion is not proven" in squashed
assert "three approved-but-unapplied legacy packets" in squashed
def test_gcp_skill_uses_current_operator_access_and_parity_truth() -> None:
text = _skill("teleo-gcp-parity-ops")
squashed = " ".join(text.split())
for required in (
"ssh teleo-gcp-staging",
"teleo-pgvector-standby",
"PostgreSQL 16.14",
"public IP disabled",
"39/39",
"52,164/52,164",
"PID `148735`",
"NRestarts=0",
"state.db",
"leoclean-cloudsql-memory-sync.service",
"gcp-canonical-parity-live-20260712.json",
"gcp-cory-model-replay-current.json",
"gcp-operator-access-blocker-current.json",
"invalid_target",
"rejected",
):
assert required in text
assert "does not store a Google password" in squashed
assert "firewall-source-dependent" in text
assert "Do not call this path working until a live `status` run passes" in text
assert "Do not describe a passing Hermes memory sync as canonical KB parity" in text
assert "Do not call control-plane inventory" in text
def test_vps_onboarding_and_cory_skills_point_to_current_proof() -> None:
vps = _skill("teleo-vps-runtime-ops")
provenance = _skill("teleo-infra-provenance")
onboarding = _skill("teleo-leo-onboarding")
cory = _skill("working-leo-cory-outcomes")
assert "reasoning tools `17`" in vps
assert "current source hashes" in vps
assert "`teleo-auto-deploy.timer`" in vps
assert "separate state changes" in vps
assert "/opt/teleo-eval/.last-deploy-sha" in provenance
assert "does not prove a gateway restart" in " ".join(provenance.split())
assert "gcp-cloud-sql-t3-live-readonly-current.md" in onboarding
assert "gcp-canonical-parity-live-20260712.json" in onboarding
assert "gcp-cory-model-replay-current.json" in onboarding
assert "working-leo-current-proof-20260712.md" in onboarding
assert "ssh teleo-gcp-staging" in onboarding
assert "37/37" in cory
assert "Approved is not the same as applied" in cory
assert "Next Cory-style follow-up:" in cory
assert "working-leo-current-proof-20260712.md" in cory