"""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/task-delivery-gates.md').read_text() self.assertIn('#### Deployment and handoff evidence', text) self.assertIn('pod image IDs', text) self.assertIn('destination channel/message ID', text) self.assertIn('not_applicable', text) self.assertIn('not user-visible acceptance', text) def test_contract_1(self): text = (ROOT / 'SKILL.md').read_text() self.assertIn('-uat', text) self.assertIn('version: 1.16.0', text) def test_stage_five_scope_and_authority(self): text = (ROOT / "references/task-delivery-gates.md").read_text() stage = text.split("### Stage 5", 1)[1].split("### Stage 6", 1)[0] self.assertIn("#### Deployment and handoff evidence", stage) self.assertNotRegex(stage, r"(?m)^## ") self.assertIn("this requirement grants no deployment authority", stage) self.assertIn("If the project requires deployment before", stage) self.assertNotIn("only if the Task explicitly includes", stage) self.assertIn("image/container/Helm artifact validation", text) self.assertIn("No implementation or review subagent", text) if __name__ == "__main__": unittest.main()