46 lines
2.2 KiB
Python
46 lines
2.2 KiB
Python
"""Offline reference contracts; approval and runtime checks remain external."""
|
|
from pathlib import Path
|
|
import re
|
|
import unittest
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
class LessonsContract(unittest.TestCase):
|
|
def test_coherent_portable_solution_workflow(self):
|
|
skill = (ROOT / 'SKILL.md').read_text()
|
|
self.assertFalse('set solution status to `In Solution`' in skill,
|
|
'must respect canonical lifecycle schema')
|
|
self.assertIn('references/aerosim-lessons-review.md', skill)
|
|
ref = ROOT / 'references/aerosim-lessons-review.md'
|
|
self.assertTrue(ref.exists())
|
|
text = ref.read_text()
|
|
for value in ('d7900acfa923d8c7bb32f6e8e269048f5d4b8d4f',
|
|
'canonical IDs', 'exact revision', 'assessment',
|
|
'Excluded', 'no-churn'):
|
|
self.assertIn(value, text)
|
|
self.assertIn('a human team member explicitly approves', skill)
|
|
for path in (ROOT / 'references').glob('*.md'):
|
|
self.assertNotRegex(path.read_text(), r'six[- ](?:authorized|channel)')
|
|
self.assertIn('No actor authority is granted by this reference',
|
|
(ROOT / 'references/delegated-solution-package-tdd.md').read_text())
|
|
|
|
def test_eight_channel_boundary(self):
|
|
skill = (ROOT / 'SKILL.md').read_text()
|
|
boundary = skill.split('## Approved Information Boundary', 1)[1].split('## ', 1)[0]
|
|
channels = re.findall(r'^corp-v1-<code>-(.+)$', boundary, re.MULTILINE)
|
|
self.assertEqual(channels, ['general', 'scope', 'architecture', 'ui-ux',
|
|
'kanban', 'delivery', 'uat', 'releases'])
|
|
self.assertNotIn('seven', skill.replace('other seven channels', 'other channels'))
|
|
self.assertIn('eight', skill)
|
|
|
|
def test_local_links_resolve(self):
|
|
for path in [ROOT / 'SKILL.md', *sorted((ROOT / 'references').glob('*.md'))]:
|
|
for link in re.findall(r'\]\(([^)]+)\)', path.read_text()):
|
|
if '://' not in link and not link.startswith(('#', '<')):
|
|
self.assertTrue((path.parent / link.split('#')[0]).exists(), (path, link))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|