teleo-infrastructure/tests/test_repo_skill_pack.py
twentyOne2x fed5cb0805 Add guarded canonical claim application
- Normalize rich proposals into atomic reviewed canonical graph bundles with exact row verification.
- Harden reviewer/apply roles, upgrade ACLs, and prove generic plus Helmer lifecycles in isolated PostgreSQL.
- Publish repo-native VPS/GCP/Cory skills and live-readonly GCP inventory without changing the live VPS runtime.

`.agents/skills/crabbox/SKILL.md`
`.agents/skills/teleo-gcp-parity-ops/SKILL.md`
`.agents/skills/teleo-kb-db-change-workflow/SKILL.md`
`.agents/skills/teleo-leo-onboarding/SKILL.md`
`.agents/skills/teleo-vps-runtime-ops/SKILL.md`
`.agents/skills/working-leo-cory-outcomes/SKILL.md`
`docs/reports/leo-working-state-20260709/approve-claim-clone-canary-current.json`
`docs/reports/leo-working-state-20260709/approve-claim-clone-canary-current.md`
`docs/reports/leo-working-state-20260709/current-truth-index.md`
`docs/reports/leo-working-state-20260709/gcp-cloud-sql-t3-live-readonly-current.json`
`docs/reports/leo-working-state-20260709/gcp-cloud-sql-t3-live-readonly-current.md`
`docs/reports/leo-working-state-20260709/gcp-cloudsql-studio-parity-gate-current.json`
`docs/reports/leo-working-state-20260709/gcp-cloudsql-studio-parity-gate-current.md`
`docs/reports/leo-working-state-20260709/gcp-parallel-delegation-current.json`
`docs/reports/leo-working-state-20260709/helmer-approve-claim-clone-canary-current.json`
`docs/reports/leo-working-state-20260709/helmer-approve-claim-normalization-current.json`
`docs/reports/leo-working-state-20260709/skill-pack-manifest.json`
`docs/reports/leo-working-state-20260709/skill-pack-readme.md`
`docs/reports/leo-working-state-20260709/working-leo-current-state-20260709.md`
`docs/reports/leo-working-state-20260709/working-leo-definition-20260709.md`
`docs/reports/leo-working-state-20260709/working-leo-execution-plan-current.md`
`scripts/apply_proposal.py`
`scripts/apply_worker.py`
`scripts/approve_proposal.py`
`scripts/kb_apply_prereqs.sql`
`scripts/kb_proposal_normalize.py`
`scripts/probe_gcp_db_parity.py`
`scripts/run_approve_claim_clone_canary.py`
`scripts/run_approve_claim_isolated_container_canary.sh`
`tests/test_apply_proposal.py`
`tests/test_apply_worker.py`
`tests/test_approve_proposal.py`
`tests/test_kb_apply_prereqs.py`
`tests/test_kb_proposal_normalize.py`
`tests/test_kb_proposal_routes.py`
`tests/test_probe_gcp_db_parity.py`
`tests/test_repo_skill_pack.py`
2026-07-10 17:49:37 +02:00

91 lines
2.9 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"]
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")
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",
):
assert required in text
assert "does not prove byte-for-byte live content" in text
assert "production permission migration" in text
def test_gcp_skill_uses_current_cloud_sql_truth_and_exact_gate() -> None:
text = _skill("teleo-gcp-parity-ops")
squashed = " ".join(text.split())
for required in (
"teleo-pgvector-standby",
"PostgreSQL `16.14`",
"teleo-staging-net",
"public IP disabled",
"Cloud SQL Studio",
"GCP Studio authenticated",
"begin transaction read only",
"DB contents",
):
assert required in text
assert "no enabled existing" in squashed
assert "IAM DB principal" in squashed
assert "Do not submit a raw password" in text
assert "AppleScript" in text
def test_vps_onboarding_and_cory_skills_point_to_current_proof() -> None:
vps = _skill("teleo-vps-runtime-ops")
onboarding = _skill("teleo-leo-onboarding")
cory = _skill("working-leo-cory-outcomes")
assert "reasoning tools `17`" in vps
assert "current source hashes" in vps
assert "gcp-cloud-sql-t3-live-readonly-current.md" in onboarding
assert "GCP Studio authenticated" not 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