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,23 @@
|
||||
{
|
||||
"retained": [
|
||||
"channel-board-skic",
|
||||
"discord",
|
||||
"documentation-docusaurus",
|
||||
"glossary-skic",
|
||||
"development-durable-wave-execution",
|
||||
"development-gates",
|
||||
"development-integrity",
|
||||
"development-method-ttd",
|
||||
"development-branching-strategy",
|
||||
"development-monorepo-pnpm",
|
||||
"development-scripts",
|
||||
"development-gitops-argo-cd-home-gondor-v1"
|
||||
],
|
||||
"additional": [
|
||||
"ci-runtime-skic",
|
||||
"delivery-docs",
|
||||
"status-reporting-skic",
|
||||
"development-security",
|
||||
"development-security-skic"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
[
|
||||
{
|
||||
"path": "references/task-delivery-gates.md",
|
||||
"sha256": "4475ccf43b8f026bdc1acee38cbe09969be6a387c71f6724cad94c8cef93e973"
|
||||
},
|
||||
{
|
||||
"path": "references/repository-entry-and-visibility.md",
|
||||
"sha256": "727d2ed32483a895237e6891b4ce78d79442d1c9e002bac4237e438fb9c4426d"
|
||||
},
|
||||
{
|
||||
"path": "references/planning-artifact-reconciliation.md",
|
||||
"sha256": "98e64da5093db3e2c18c84a54993d1413e59a42f86788504ed63117ff069392f"
|
||||
},
|
||||
{
|
||||
"path": "references/aerosim-lessons-review.md",
|
||||
"sha256": "e66dbafba963f95831ed230b15cee67b23677024bdbf464dae8cb2deb906a96e"
|
||||
},
|
||||
{
|
||||
"path": "SKILL.md",
|
||||
"heading": "Authority and Escalation",
|
||||
"sha256": "85635a7e636529593e5ed98ff8884b7078e429123442c59ae4f7db94cc1e0e40"
|
||||
},
|
||||
{
|
||||
"path": "SKILL.md",
|
||||
"heading": "UI/UX Coordination",
|
||||
"sha256": "c7331b08010fc4f931543a5ced352cc05d16df122aea2abafc3b3221da05b18d"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"home-v1-skills-code-agent/development-gates": "global-skills/development-gates",
|
||||
"home-v1-skills-code-agent/development-integrity": "global-skills/development-integrity",
|
||||
"home-v1-skills-code-agent/development-method-ttd": "global-skills/development-method-ttd",
|
||||
"home-v1-skills-code-agent/development-durable-wave-execution": "global-skills/development-durable-wave-execution",
|
||||
"home-v1-skills-code-agent/development-monorepo-pnpm": "global-skills/development-monorepo-pnpm",
|
||||
"home-v1-skills-code-agent/development-branching-strategy": "global-skills/development-branching-strategy",
|
||||
"home-v1-skills-code-agent/development-scripts": "global-skills/development-scripts",
|
||||
"home-v1-skills-code-agent/devsecops-ci-cd-gitea": "global-skills/devsecops-ci-cd-gitea",
|
||||
"corp-v1-aerosim-skills-code-agent/documentation-docusaurus-aerosim": "skic-aerosim-skills/documentation-docusaurus-skic-aerosim",
|
||||
"corp-v1-aerosim-skills-code-agent/development-scripts-aerosim": "skic-aerosim-skills/development-scripts-skic-aerosim",
|
||||
"corp-v1-aerosim-skills-code-agent/development-branching-strategy-aerosim": "skic-aerosim-skills/development-branching-strategy-skic-aerosim",
|
||||
"corp-v1-aerosim-skills-code-agent/devsecops-ci-cd-gitea-aerosim": "skic-aerosim-skills/devsecops-ci-cd-gitea-skic-aerosim",
|
||||
"home-v1-skills-code-agent/development-gitops-argo-cd-gondor-v1": "home-gondor-v1-skills/development-gitops-argo-cd-home-gondor-v1"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
from pathlib import Path
|
||||
import os
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
def owner(name):
|
||||
base=Path(os.environ.get('DELIVERY_OWNER_ROOT',str(ROOT.parent)))
|
||||
direct=base/name/'SKILL.md'
|
||||
found=[direct] if direct.is_file() else list(base.glob('*/'+name+'/SKILL.md'))
|
||||
if len(found)!=1: raise RuntimeError('Owner missing or ambiguous: '+name+' under '+str(base))
|
||||
return found[0].read_text()
|
||||
def effective(path):
|
||||
text=(ROOT/path).read_text()
|
||||
routes={'references/runtime-and-ci.md':['ci-runtime-skic'], 'references/status-and-reporting.md':['status-reporting-skic'], 'references/failure-and-documentation.md':['ci-runtime-skic','status-reporting-skic','delivery-docs']}
|
||||
return text+'\n'+'\n'.join(owner(n) for n in routes.get(path,[]))
|
||||
@@ -0,0 +1 @@
|
||||
0d7de8761e3c27908cef45c05a16e36cc36dce0dd428027002c632c34c8448bf
|
||||
@@ -39,7 +39,7 @@ class LessonsContract(unittest.TestCase):
|
||||
def test_contract_1(self):
|
||||
text = (ROOT / 'SKILL.md').read_text()
|
||||
self.assertIn('<code>-uat', text)
|
||||
self.assertIn('version: 1.15.0', text)
|
||||
self.assertIn('version: 1.16.0', text)
|
||||
|
||||
def test_stage_five_scope_and_authority(self):
|
||||
text = (ROOT / "references/task-delivery-gates.md").read_text()
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
"""Canonical bindings preserve owners and original checksum sensitivity."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import re
|
||||
import subprocess
|
||||
import unittest
|
||||
from canonical_identity import IDENTITIES, canonicalize, original_identity
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
class CanonicalIdentity(unittest.TestCase):
|
||||
def test_exact_identity_and_dependency_count(self):
|
||||
current = (ROOT / 'SKILL.md').read_text()
|
||||
baseline = subprocess.check_output(['git', 'show', 'HEAD:SKILL.md'], cwd=ROOT, text=True)
|
||||
def deps(text):
|
||||
return re.search(r'related_skills: \[(.*?)\]', text)[1].split(', ')
|
||||
expected = [IDENTITIES.get(v, v) for v in deps(baseline)]
|
||||
self.assertEqual(deps(current), expected)
|
||||
self.assertEqual(len(expected), 18 if ROOT.name.endswith('aerosim') else 12)
|
||||
self.assertEqual(len(set(expected)), len(expected))
|
||||
self.assertIn('corp-v1-glossary', expected)
|
||||
self.assertFalse(set(expected) & set(IDENTITIES))
|
||||
|
||||
def test_mapping_is_reversible_and_not_a_general_rewrite(self):
|
||||
self.assertEqual(len(IDENTITIES), len(set(IDENTITIES.values())))
|
||||
for old, new in IDENTITIES.items():
|
||||
text = f'Load `{old}`; skill_view(name="{old}"); https://example/{old}; /opt/data/{old}/'
|
||||
mapped = canonicalize(text)
|
||||
self.assertIn(f'`{new}`', mapped)
|
||||
self.assertEqual(original_identity(mapped), text)
|
||||
text = 'tags: [corp-v1, discord, channel] /opt/data/corp-v1-aerosim-delivery/ gondor-v1-aerosim-dev'
|
||||
self.assertEqual(original_identity(text), text)
|
||||
|
||||
def test_golden_normalization_still_detects_policy_mutation(self):
|
||||
for old in IDENTITIES:
|
||||
baseline = f'Load `{old}` before mutation; stop if unavailable.'
|
||||
canonical = canonicalize(baseline)
|
||||
digest = lambda t: hashlib.sha256(original_identity(t).encode()).hexdigest()
|
||||
self.assertEqual(digest(canonical), digest(baseline))
|
||||
self.assertNotEqual(digest(canonical.replace('stop', 'continue')), digest(baseline))
|
||||
|
||||
def test_no_legacy_operational_loads(self):
|
||||
for path in [ROOT / 'SKILL.md', *ROOT.glob('references/*.md')]:
|
||||
text = path.read_text()
|
||||
self.assertEqual(canonicalize(text), text, str(path))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -1,18 +1,19 @@
|
||||
from pathlib import Path
|
||||
from disposition_support import effective
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SKILL = (ROOT / "SKILL.md").read_text(encoding="utf-8")
|
||||
RUNTIME = (ROOT / "references/runtime-and-ci.md").read_text(encoding="utf-8")
|
||||
RUNTIME = effective("references/runtime-and-ci.md")
|
||||
|
||||
REFERENCES = {
|
||||
"development-durable-wave-execution": "https://gitea.lego-cloud.eu/home-v1-skills-code-agent/development-durable-wave-execution",
|
||||
"development-gates": "https://gitea.lego-cloud.eu/home-v1-skills-code-agent/development-gates",
|
||||
"development-integrity": "https://gitea.lego-cloud.eu/home-v1-skills-code-agent/development-integrity",
|
||||
"development-method-ttd": "https://gitea.lego-cloud.eu/home-v1-skills-code-agent/development-method-ttd",
|
||||
"development-branching-strategy": "https://gitea.lego-cloud.eu/home-v1-skills-code-agent/development-branching-strategy",
|
||||
"development-monorepo-pnpm": "https://gitea.lego-cloud.eu/home-v1-skills-code-agent/development-monorepo-pnpm",
|
||||
"development-scripts": "https://gitea.lego-cloud.eu/home-v1-skills-code-agent/development-scripts",
|
||||
"development-gitops-argo-cd-home-gondor-v1": "https://gitea.lego-cloud.eu/home-v1-skills-code-agent/development-gitops-argo-cd-gondor-v1",
|
||||
"development-durable-wave-execution": "https://gitea.lego-cloud.eu/global-skills/development-durable-wave-execution",
|
||||
"development-gates": "https://gitea.lego-cloud.eu/global-skills/development-gates",
|
||||
"development-integrity": "https://gitea.lego-cloud.eu/global-skills/development-integrity",
|
||||
"development-method-ttd": "https://gitea.lego-cloud.eu/global-skills/development-method-ttd",
|
||||
"development-branching-strategy": "https://gitea.lego-cloud.eu/global-skills/development-branching-strategy",
|
||||
"development-monorepo-pnpm": "https://gitea.lego-cloud.eu/global-skills/development-monorepo-pnpm",
|
||||
"development-scripts": "https://gitea.lego-cloud.eu/global-skills/development-scripts",
|
||||
"development-gitops-argo-cd-home-gondor-v1": "https://gitea.lego-cloud.eu/home-gondor-v1-skills/development-gitops-argo-cd-home-gondor-v1",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
@@ -1,55 +0,0 @@
|
||||
"""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()
|
||||
@@ -1,39 +0,0 @@
|
||||
"""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()
|
||||
@@ -1,54 +0,0 @@
|
||||
"""Offline bounded simplification contract; no dependency or network mutation."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
class SimplificationContract(unittest.TestCase):
|
||||
def test_retained_safety_sections(self):
|
||||
for (path, start, end), digest in SECTIONS.items():
|
||||
text = (ROOT / path).read_text().split(start, 1)[1]
|
||||
if end:
|
||||
text = text.split(end, 1)[0]
|
||||
self.assertEqual(hashlib.sha256(text.encode()).hexdigest(), digest, (path, start))
|
||||
|
||||
def test_dependencies_unchanged(self):
|
||||
self.assertIn(DEPS, (ROOT / 'SKILL.md').read_text())
|
||||
|
||||
def test_unresolved_gates_and_safety_files_unchanged(self):
|
||||
for name, digest in PROTECTED.items():
|
||||
self.assertEqual(hashlib.sha256((ROOT / name).read_bytes()).hexdigest(), digest, name)
|
||||
|
||||
def test_decision_point_loads(self):
|
||||
for name, markers in {
|
||||
'SKILL.md': ['Before login, load', 'skic-skills/channel-board-skic', 'version: 1.15.0'],
|
||||
'references/runtime-and-ci.md': ['Before login, load', 'Load `development-method-ttd`', 'Load `development-monorepo-pnpm`'],
|
||||
'references/status-and-reporting.md': ['Before reporting, load', 'home-v1-skills-code-agent/development-integrity'],
|
||||
'references/planning-artifact-reconciliation.md': ['corepack enable --install-directory', 'Before reporting, load'],
|
||||
'references/failure-and-documentation.md': ['Before authoring or validating documentation, load', 'home-v1-skills-code-agent/corp-v1-glossary'],
|
||||
}.items():
|
||||
for marker in markers:
|
||||
self.assertIn(marker, (ROOT / name).read_text(), (name, marker))
|
||||
|
||||
def test_no_helper_or_reference_removed(self):
|
||||
self.assertEqual({p.name for p in (ROOT / 'references').glob('*.md')}, REFERENCES)
|
||||
self.assertNotIn('SIMPLIFICATION.md', (ROOT / 'SKILL.md').read_text())
|
||||
|
||||
def test_retained_reporting_and_planning_guards(self):
|
||||
status = (ROOT / 'references/status-and-reporting.md').read_text()
|
||||
for marker in ['wave-previous:', 'List every Task', 'GATE_003_TASK_IMPLEMENTATION', 'status unverified', 'exact failed command']:
|
||||
self.assertIn(marker, status)
|
||||
planning = (ROOT / 'references/planning-artifact-reconciliation.md').read_text()
|
||||
for marker in ['complete successful job inventory including aggregates', 'run_number', 'semantics', 'If the PR merged or closed', 'no second Focus-admission', 'configured silent response']:
|
||||
self.assertIn(marker, planning)
|
||||
|
||||
def test_operational_size_reduction(self):
|
||||
paths = [ROOT / 'SKILL.md', *ROOT.glob('references/*.md')]
|
||||
self.assertLess(sum(len(p.read_bytes()) for p in paths), BASELINE_BYTES)
|
||||
|
||||
DEPS = ' related_skills: [channel-board-skic, discord, documentation-docusaurus, corp-v1-glossary, development-durable-wave-execution, development-gates, development-integrity, development-method-ttd, development-branching-strategy, development-monorepo-pnpm, development-scripts, development-gitops-argo-cd-home-gondor-v1]'
|
||||
PROTECTED = {'references/repository-entry-and-visibility.md': 'f040d6f57c4ec5faf4527296f7f71a751fab2153809e2dbe20c90cf2d582a77d', 'references/aerosim-lessons-review.md': '03873d038f146e28ea648c95f7c2e32d2648d1b5eaa963fb635980fe6e814514'}
|
||||
REFERENCES = {'task-delivery-gates.md', 'common-pitfalls.md', 'failure-and-documentation.md', 'runtime-and-ci.md', 'repository-entry-and-visibility.md', 'aerosim-lessons-review.md', 'planning-artifact-reconciliation.md', 'status-and-reporting.md'}
|
||||
SECTIONS = {('references/runtime-and-ci.md', '## Channel-owned workspace', '## Shared Corp'): '48d1e74b737db691ec31ac593400d59abc7d4eed4cd67b2f12f8a428a48034b5', ('SKILL.md', '## Authority and Escalation', '## Evidence Requirements'): 'e3c566055d9d04d3ab0286e6e5035a8c30f66a81b17b4d0379e8010dead3fa83'}
|
||||
BASELINE_BYTES = 84789
|
||||
@@ -1,45 +1,7 @@
|
||||
"""Run every unittest, standalone test function and main-style contract."""
|
||||
"""Validate the current bounded source contract, not full-program completion."""
|
||||
from pathlib import Path
|
||||
import importlib.util
|
||||
import inspect
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
import subprocess,sys
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
TESTS=Path(__file__).resolve().parent
|
||||
sys.path.insert(0, str(TESTS))
|
||||
suite=unittest.TestSuite()
|
||||
modules=[]
|
||||
for path in sorted(TESTS.glob('test_*.py')):
|
||||
spec=importlib.util.spec_from_file_location('verify_'+path.stem,path)
|
||||
assert spec is not None and spec.loader is not None
|
||||
module=importlib.util.module_from_spec(spec)
|
||||
sys.modules[spec.name]=module
|
||||
spec.loader.exec_module(module)
|
||||
modules.append(module)
|
||||
suite.addTests(unittest.defaultTestLoader.loadTestsFromModule(module))
|
||||
result=unittest.TextTestRunner(verbosity=1).run(suite)
|
||||
if not result.wasSuccessful(): sys.exit(1)
|
||||
standalone=0
|
||||
for module in modules:
|
||||
for name,fn in inspect.getmembers(module,inspect.isfunction):
|
||||
if name.startswith('test_') or name=='main':
|
||||
fn()
|
||||
standalone+=1
|
||||
files=[ROOT/'SKILL.md',*sorted(ROOT.glob('references/*.md'))]
|
||||
links=0
|
||||
for path in files:
|
||||
for link in re.findall(r'\]\(([^)]+)\)',path.read_text()):
|
||||
if '://' in link or link.startswith(('#','<')): continue
|
||||
target=link.split('#')[0]
|
||||
if target:
|
||||
assert (path.parent/target).exists(),(path,link)
|
||||
links+=1
|
||||
subprocess.run(['git','diff','--check'],cwd=ROOT,check=True)
|
||||
before=sum(len(subprocess.check_output(['git','show','HEAD:'+str(p.relative_to(ROOT))],cwd=ROOT)) for p in files)
|
||||
after=sum(p.stat().st_size for p in files)
|
||||
ref_before=before-len(subprocess.check_output(['git','show','HEAD:SKILL.md'],cwd=ROOT))
|
||||
ref_after=after-(ROOT/'SKILL.md').stat().st_size
|
||||
print(json.dumps({'package':ROOT.name,'unittest':result.testsRun,'standalone':standalone,'total':result.testsRun+standalone,'local_links':links,'diff_check':'passed','operational_bytes_before':before,'operational_bytes_after':after,'reference_bytes_before':ref_before,'reference_bytes_after':ref_after},indent=2))
|
||||
if __name__=='__main__':
|
||||
print('Source-contract checks only; A02/A04/A17 and deferred helpers are not completion claims.',flush=True)
|
||||
subprocess.run([sys.executable,'-m','pytest','-q',str(Path(__file__).parent)],cwd=ROOT,check=True)
|
||||
Reference in new issue
Block a user