Files
channel-kanban-skic/tests/test_contracts.py

45 lines
2.5 KiB
Python

"""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_admission_not_backlog_gate(self):
refresh = ref('recurring-refresh-and-publication.md')
self.assertNotIn('never admit an exact task to `InBacklog`', refresh)
self.assertIn('never admit an exact task to `ReadyForDelivery`', refresh)
self.assertIn('explicitly approves that exact task', SKILL)
def test_bootstrap_matches_five_columns(self):
bootstrap = ref('kanban-bootstrap-and-validation.md')
self.assertIn('all five allowed Board columns', bootstrap)
self.assertNotIn('all four allowed Board columns', bootstrap)
self.assertIn('`InBacklog`, `ReadyForDelivery`, `InProgress`, and `ToBeReleased` sections', bootstrap)
self.assertNotIn('these four board states', SKILL)
def test_unmapped_execution_does_not_clear_other_work(self):
for text in [SKILL, ref('recurring-refresh-and-publication.md')]:
self.assertIn('preserve unrelated valid Focus items', text)
self.assertIn('does not create another Task status or authorize release', SKILL)
self.assertIn('topology is not mutation authority', SKILL)
def test_execution_boundary_preserved(self):
for term in ['not an implementation session', 'delegated or spawned work', 'implementation approval does not waive it', 'separate from Scope-owned canonical delivery status']:
self.assertIn(term, SKILL)
def test_eight_channel_boundary(self):
boundary = SKILL.split('## Approved Information Boundary')[1].split('## ', 1)[0]
channels = re.findall(r'^<code>-(.+)$', boundary, re.M)
self.assertEqual(channels, ['general', 'scope', 'architecture', 'ui-ux', 'kanban', 'delivery', 'uat', 'releases'])
self.assertIn('1552966246591365123', boundary)
if __name__ == '__main__':
unittest.main()