refactor: implement governed Delivery program contracts
This commit is contained in:
1 parent
c306ea4794
commit
65e546c448
18 files changed
+575
-99
No files matched your search
@@ -0,0 +1,39 @@
|
||||
"""Moved owner mechanics and retained caller authority, independently runnable."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import json
|
||||
import unittest
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
class OwnerConsolidation(unittest.TestCase):
|
||||
def test_owner_evidence_and_clause_mapping(self):
|
||||
manifest=json.loads((Path(__file__).parent/'owner-consolidation-manifest.json').read_text())
|
||||
self.assertEqual(len(manifest['superseded_golden_rules']),2)
|
||||
self.assertEqual(len(manifest['moved_clauses']),8)
|
||||
for owner in manifest['owners'].values():
|
||||
self.assertEqual(hashlib.sha256(owner['evidence_text'].encode()).hexdigest(),owner['sha256'])
|
||||
self.assertEqual(len(owner['inspected_head']),40)
|
||||
for move in manifest['moved_clauses']:
|
||||
text=manifest['owners'][move['owner_key']]['evidence_text']
|
||||
for heading in move['section'].split('; '):
|
||||
self.assertIn('## '+heading.split(' 1')[0].split(' 3')[0].split(' 5')[0],text)
|
||||
pre=manifest['owners']['preflight']['evidence_text']
|
||||
for term in ['command -v node','pnpm --version','without reading or printing their values','linked branch/PR identity','repeat the complete preflight','never an application-code or test failure']:
|
||||
self.assertIn(term,pre)
|
||||
base=manifest['owners']['base_images']['evidence_text']
|
||||
for term in ['without registry credentials','full 40-character source revision','shell interpolation','wrong upstream or consumer digests','pnpm install --frozen-lockfile --ignore-scripts','numeric non-root identity','CA trust','last known-good digest']:
|
||||
self.assertIn(term,base)
|
||||
def test_exact_decision_loads_and_local_boundaries(self):
|
||||
text=(ROOT/'references/runtime-and-ci.md').read_text()
|
||||
manifest=json.loads((Path(__file__).parent/'owner-consolidation-manifest.json').read_text())
|
||||
for owner in manifest['owners'].values():
|
||||
self.assertIn('skill_view(name="'+owner['owner']+'", file_path="'+owner['reference']+'")',text)
|
||||
for clause in manifest['retained_local']:
|
||||
self.assertIn(clause,text)
|
||||
for clause in ['before every repository operation','Node/pnpm repository','CORP_V1_','publication/install','immutable owner revision','forward only','replacement image and consuming workflow pass exact-head CI']:
|
||||
self.assertIn(clause,text)
|
||||
self.assertNotIn('neither owner currently replaces',text)
|
||||
self.assertNotIn('1. resolve the repository-required Node',text)
|
||||
self.assertNotIn('- Keep one folder per image',text)
|
||||
repo='corp-v1-aerosim/corp-v1-aerosim-base-images' if ROOT.name.endswith('aerosim') else 'corp-v1-<code>/corp-v1-<code>-base-images'
|
||||
self.assertIn(repo,text)
|
||||
if __name__=='__main__': unittest.main()
|
||||
Reference in new issue
Block a user