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

59 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 / 'SKILL.md').read_text()
self.assertIn('## UAT promotion gate', text)
self.assertIn('A release request does not waive UAT', text)
self.assertIn('distinct production desired-state revision', text)
self.assertIn('human post-release acceptance', text)
self.assertIn('new immutable corrective release', text)
self.assertIn('corp-v1-<code>-uat', text)
self.assertIn('version: 1.7.0', text)
def test_contract_1(self):
text = (ROOT / 'references/recurring-readiness-pr-refresh.md').read_text()
self.assertIn('General, Scope, Architecture, UI/UX, Kanban, Delivery, UAT, and Releases', text)
def test_separate_authority_and_no_stale_channel_count(self):
text = (ROOT / "SKILL.md").read_text()
refresh = (ROOT / "references/recurring-readiness-pr-refresh.md").read_text()
self.assertIn("Do not merge, synchronize GitOps, or deploy unless", text)
self.assertIn("the team separately approves that action", text)
self.assertIn("a UAT pass does not authorize release", text)
self.assertIn("Do not silently retag or overwrite", text)
self.assertIn("do not post a duplicate message", text)
self.assertNotIn("all six allowed", refresh)
self.assertIn("latest exact-head CI", text)
if __name__ == "__main__":
unittest.main()