refactor: implement concrete Delivery responsibility dispositions
This commit is contained in:
1 parent
cb6b41f1a5
commit
1bff2cefab
23 files changed
+231
-717
No files matched your search
@@ -0,0 +1,74 @@
|
||||
"""Disposition regression: immutable authority, concrete loads and moved policy."""
|
||||
from pathlib import Path
|
||||
import hashlib,json,re,unittest
|
||||
from disposition_support import ROOT,owner,effective
|
||||
TESTS=Path(__file__).parent
|
||||
class Disposition(unittest.TestCase):
|
||||
def test_authority_and_unresolved_gates_unchanged(self):
|
||||
mapping=json.loads((TESTS/'disposition-url-map.json').read_text())
|
||||
for f in json.loads((TESTS/'disposition-protected.json').read_text()):
|
||||
t=(ROOT/f['path']).read_text()
|
||||
for old,new in mapping.items(): t=t.replace('https://gitea.lego-cloud.eu/'+new,'https://gitea.lego-cloud.eu/'+old)
|
||||
t=t.replace('glossary-skic','corp-v1-glossary')
|
||||
if 'heading' in f: t=re.search(r'^## '+re.escape(f['heading'])+r'\n.*?(?=^## |\Z)',t,re.M|re.S).group()
|
||||
if 'block' in f: t=re.search(r'<!-- '+f['block']+r':BEGIN -->.*?<!-- '+f['block']+r':END -->',t,re.S).group()
|
||||
self.assertEqual(hashlib.sha256(t.rstrip().encode()).hexdigest(),f['sha256'],f)
|
||||
def test_all_retained_and_real_additional_dependencies(self):
|
||||
t=(ROOT/'SKILL.md').read_text(); d=json.loads((TESTS/'disposition-dependencies.json').read_text())
|
||||
actual=re.search(r'related_skills: \[(.*?)\]',t).group(1).split(', ')
|
||||
self.assertEqual(actual,d['retained']+d['additional']); self.assertEqual(len(actual),len(set(actual)))
|
||||
self.assertNotIn('develop-monorepo-pnpm-app-skic',actual); self.assertNotIn('develop-monorepo-pnpm-package-skic',actual)
|
||||
for n in d['additional']:
|
||||
self.assertIn('`'+n+'`',t)
|
||||
for n in ['gitops-manifest-engineering','gondor-v1-nodes']:
|
||||
self.assertIn(n,t if ROOT.name.endswith('aerosim') else owner('ci-runtime-skic'))
|
||||
def test_no_removed_reports_or_empty_sections(self):
|
||||
t=(ROOT/'SKILL.md').read_text()
|
||||
for n in ['ADOPTION.md','FULL-PROGRAM.md','naming-delivery-review.md','SIMPLIFICATION.md']:self.assertFalse((ROOT/n).exists())
|
||||
for h in ['Overview','When to Use','Common Pitfalls','Project-Adoption Delivery Lessons','Proactive Iteration Requirement','Verification Checklist','Shared Corp v1 System Login','Documentation Ownership']:
|
||||
self.assertNotIn('## '+h+'\n',t)
|
||||
self.assertIn('## Synchronization Workflow',t)
|
||||
if not ROOT.name.endswith('aerosim'):
|
||||
self.assertIn('references/final-verification.md',t)
|
||||
self.assertTrue((ROOT/'references/final-verification.md').is_file())
|
||||
def test_complete_vocabulary_and_templates_moved_once(self):
|
||||
t=owner('status-reporting-skic').split('## Scope Status Vocabulary',1)[1].split('## Blocker routing',1)[0]
|
||||
self.assertEqual(hashlib.sha256(('## Scope Status Vocabulary'+t).rstrip().encode()).hexdigest(),(TESTS/'report-format.sha256').read_text().strip())
|
||||
local=(ROOT/'references/status-and-reporting.md').read_text()
|
||||
self.assertNotIn('wave-previous:',local)
|
||||
self.assertIn('status-reporting-skic',local);self.assertIn('development-integrity',local)
|
||||
def test_scoped_owner_mechanics_and_fail_closed_loads(self):
|
||||
ci=owner('ci-runtime-skic')
|
||||
for s in ['every foreground shell','last known-good digest','credential-free','per-run database/schema/role','deletion-reclaim','Bitwarden','exact-context','stop','self-hosted-service-account-recovery','truenas','references/base-images.md','references/runtime-preflight.md','repeat diagnosis, repair','same Task/gate','Before Delivery publication/install or operational adoption','complete published and installed owner packages','immutable owner revision and reference hash','Stop adoption if this evidence is unresolved']:
|
||||
self.assertIn(s,ci)
|
||||
for s in ['devsecops-ci-cd-gitea-skic-aerosim','development-scripts-skic-aerosim','gitops-manifest-engineering','gondor-v1-nodes']:
|
||||
self.assertIn(s,ci)
|
||||
local=(ROOT/'references/runtime-and-ci.md').read_text()
|
||||
self.assertIn('ci-runtime-skic',local);self.assertIn('development-security-skic',local)
|
||||
self.assertNotIn('├── cache/',local)
|
||||
self.assertIn('isolated, unpublished experimental delta',local)
|
||||
self.assertIn('historical missing RED',local)
|
||||
def test_documentation_outcomes_and_binding(self):
|
||||
docs=owner('delivery-docs'); local=(ROOT/'references/failure-and-documentation.md').read_text()
|
||||
for s in ['five sections','Delivery workflow','Collaboration and decisions','Packaging and deployment preparation','Operations and troubleshooting','planned process as already operational','source identity','read back']:
|
||||
self.assertIn(s,docs)
|
||||
self.assertNotIn('### Ways of Working',local);self.assertIn('delivery-docs',local)
|
||||
self.assertIn('glossary-skic',local)
|
||||
self.assertIn('documentation-docusaurus-skic-aerosim' if ROOT.name.endswith('aerosim') else 'documentation-docusaurus',local)
|
||||
def test_security_preserves_single_policy_owner(self):
|
||||
security=owner('development-security-skic'); generic=owner('development-security')
|
||||
for s in ['channel-board-skic','Corp v1 System SSO Credential Use','Stop before login','development-security','Central Delivery gains no self-recovery authority']:
|
||||
self.assertIn(s,security)
|
||||
self.assertNotIn('HL_V1_SSO_PASSWORD',security+generic)
|
||||
for s in ['presence only','never inspect, hash or measure','generic 401/403','separately verified delegation','not authority']:
|
||||
self.assertIn(s,generic)
|
||||
def test_local_markdown_targets_and_anchors_exist(self):
|
||||
for p in [ROOT/'SKILL.md',*ROOT.glob('references/*.md')]:
|
||||
for link in re.findall(r'\]\(([^)]+)\)',p.read_text()):
|
||||
if '://' in link or link.startswith('<'):continue
|
||||
path,_,anchor=link.partition('#');dest=p.parent/path if path else p
|
||||
self.assertTrue(dest.is_file(),(p,link))
|
||||
if anchor:
|
||||
anchors={re.sub(r'[^\w -]','',h.lower()).replace(' ','-') for h in re.findall(r'^#+ (.*)',dest.read_text(),re.M)}
|
||||
self.assertIn(anchor,anchors,(p,link))
|
||||
if __name__=='__main__':unittest.main()
|
||||
Reference in new issue
Block a user