Files
channel-uat-skic/tests/test_aerosim_lessons_contract.py
T

61 lines
2.7 KiB
Python

"""Offline regression tests for the channel's published prose contract."""
from pathlib import Path
import re
import unittest
ROOT = Path(__file__).resolve().parents[1]
class LessonsContract(unittest.TestCase):
def test_review_provenance_and_link(self):
review = ROOT / "references/aerosim-lessons-review.md"
self.assertTrue(review.is_file())
text = review.read_text()
self.assertRegex(text, r"/src/commit/[0-9a-f]{40}/")
self.assertIn("## Exclusions", text)
self.assertIn("aerosim-lessons-review.md", (ROOT / "SKILL.md").read_text())
def test_local_markdown_links_resolve(self):
for path in [ROOT / "SKILL.md", *ROOT.glob("references/*.md")]:
for target in re.findall(r"\]\(([^)]+)\)", path.read_text()):
if "://" not in target and not target.startswith(("#", "<")):
self.assertTrue((path.parent / target.split("#")[0]).is_file(), (path, target))
def test_no_project_authority_transplant(self):
for path in [ROOT / "SKILL.md", *ROOT.glob("references/*.md")]:
if path.name == "aerosim-lessons-review.md":
continue
text = path.read_text()
for forbidden in ("jarvis-at-skic", "aerosim-dev.apps", "AEROSIM_STANDING", "1537388451501056081"):
self.assertNotIn(forbidden, text)
def test_contract_0(self):
text = (ROOT / 'references/deployment-evidence-contract.md').read_text()
self.assertIn('template commit is provenance', text)
self.assertIn('before and after', text)
self.assertIn('root and runtime', text)
self.assertIn('never combine results', text)
def test_contract_1(self):
text = (ROOT / 'references/journey-repository-contract.md').read_text()
self.assertIn('ordinary user interactions', text)
self.assertIn('diagnosis, not acceptance', text)
self.assertIn('required journey/browser matrix', text)
def test_contract_2(self):
text = (ROOT / 'SKILL.md').read_text()
self.assertIn('version: 1.4.0', text)
def test_preserved_ownership_and_invalidation(self):
repo = (ROOT / "references/journey-repository-contract.md").read_text()
evidence = (ROOT / "references/deployment-evidence-contract.md").read_text()
reporting = (ROOT / "references/status-and-reporting.md").read_text()
self.assertIn("Helm installation/rendering", repo)
self.assertIn("cannot support `UAT_PASSED`", repo)
self.assertIn("Missing post-run identity or health evidence blocks", evidence)
self.assertIn("verified handoff receipt", reporting)
self.assertIn("exact E2E commit", reporting)
if __name__ == "__main__":
unittest.main()