Files
channel-delivery-skic/tests/test_full_program.py

56 lines
3.4 KiB
Python

"""Full-program consolidation: owner routing and retained policy safeguards."""
from pathlib import Path
import unittest
from canonical_identity import original_identity
ROOT=Path(__file__).resolve().parents[1]
def read(p): return (ROOT/p).read_text()
class FullProgram(unittest.TestCase):
def test_exact_owner_loads_replace_duplicate_algorithms(self):
p=read('references/planning-artifact-reconciliation.md')
for s in ['skill_view(name="development-gates")','skill_view(name="development-integrity")','exact Task row','historical','no second Focus-admission','run_number','head.ref']:
self.assertIn(s,p)
self.assertNotIn('Require each matching task to report',p)
self.assertLess(len(p.encode()),5000)
g=read('references/task-delivery-gates.md')
self.assertIn('skill_view(name="development-gates")',g)
self.assertNotIn('first when practical',g)
self.assertNotIn('seven project channels',g)
self.assertIn('A02/A04',g)
for i in range(1,7): self.assertIn(f'GATE_{i:03}_',g)
def test_storage_and_ttd_decision_loads(self):
r=read('references/runtime-and-ci.md')
self.assertIn('references/gondor-retained-application-storage.md',r)
self.assertIn('before storage design or mutation',r.lower())
self.assertNotIn('before fixing when practical',r)
self.assertIn('development-method-ttd',r)
self.assertIn('isolated, unpublished experimental delta',r)
self.assertIn('historical missing RED',r)
self.assertNotIn('5. implement the smallest safe fix;\n6. add/update tests',read('references/failure-and-documentation.md'))
self.assertIn('last known-good digest',r)
self.assertIn('every foreground shell',r)
def test_clause_disposition_covers_program_without_inventing_resolution(self):
p=read('FULL-PROGRAM.md')
for i in range(1,19): self.assertIn(f'| A{i:02} |',p)
for s in ['1563064779772526616','unresolved','installed','publication','A02','A04','A06','A08','A17']:
self.assertIn(s,p)
def test_original_protected_clauses_remain_exact(self):
import re, json, hashlib
for rule in json.loads((Path(__file__).parent/'full-program-preserved.json').read_text()):
matches=re.findall(rule['pattern'],original_identity(read(rule['path'])),re.M)
self.assertEqual([hashlib.sha256(m.encode()).hexdigest() for m in matches],rule['hashes'],rule['path']+' '+rule['pattern'])
def test_project_specific_boundaries(self):
if not (ROOT/'references/single-subagent-task-delivery.md').exists(): return
w=read('references/single-subagent-task-delivery.md')
self.assertNotIn('│ ├── playwright/',w)
self.assertNotIn('│ ├── postgresql/',w)
self.assertIn('belong to UAT',w)
g=read('references/task-delivery-gates.md')
self.assertIn('per Task',g)
self.assertNotIn('or start the next Task before',g)
c=read('references/gitea-actions-policy.md')
for s in ['skill_view(name="devsecops-ci-cd-gitea-skic-aerosim")','references/pipeline-workflow.md','CI / Branch Readiness','CI / Pull Request Validation','CD / Test Artifact Publication','publication','UAT','all applications']:
self.assertIn(s,c)
self.assertNotIn('## 1. Non-default branch',c)
self.assertLess(len(c.encode()),3200)
if __name__=='__main__': unittest.main()