"""Offline regression tests for normative skill-package contracts, not runtime behavior.""" from pathlib import Path import re import unittest ROOT = Path(__file__).resolve().parents[1] SKILL = (ROOT / 'SKILL.md').read_text() def ref(name): return (ROOT / 'references' / name).read_text() class Contracts(unittest.TestCase): def test_evidence_and_links(self): self.assertIn('(references/aerosim-lessons-review.md)', SKILL) evidence = ref('aerosim-lessons-review.md') self.assertRegex(evidence, r'Source commit: `[0-9a-f]{40}`') self.assertIn('## Exclusions', evidence) for path in re.findall(r'\]\((references/[^)#]+)(?:#[^)]*)?\)', SKILL): self.assertTrue((ROOT / path).is_file(), path) def test_scope_is_single_contract(self): self.assertIn('Load the mapped Scope skill', SKILL) self.assertNotIn('Minimum Epic Features table', SKILL) self.assertNotIn('Use lifecycle states `Proposed`', SKILL) self.assertIn('not delivery states', SKILL) def test_convergence_precedes_report(self): workflow = SKILL.split('## Synchronization Workflow')[1].split('## Authority')[0] self.assertLess(workflow.index('After CI/readback'), workflow.index('Return one concise update')) for term in ['per-channel high-watermarks', 'substantive evidence IDs', 'continuations in full', 'do not also send a channel message', 'repository readback is not message delivery']: self.assertIn(term, workflow) def test_approval_and_bootstrap_preserved(self): for term in ['Only a human team member', 'first-human-message stop condition', 'no project scheduler', 'eight same-project channels']: self.assertIn(term, SKILL) def test_eight_channel_boundary(self): boundary = SKILL.split('## Approved Information Boundary')[1].split('## ', 1)[0] channels = re.findall(r'^corp-v1--(.+)$', boundary, re.M) self.assertEqual(channels, ['general', 'scope', 'architecture', 'ui-ux', 'kanban', 'delivery', 'uat', 'releases']) self.assertIn('1552966246591365123', boundary) bootstrap = SKILL.split('## Governed bootstrap autonomy')[1].split('## Approved Information Boundary')[0] self.assertIn('Historical seven-channel overrides remain limited', bootstrap) self.assertIn('topology update alone does not expand autonomous scope', bootstrap) if __name__ == '__main__': unittest.main()