This commit is contained in:
eddiesoehnel committed 2026-10-19 12:56:31 -06:00
1 parent df7571392e
commit a47b915ed5
27 files changed
+135 -1352

No files matched your search

+24 -2
View File
@@ -32,7 +32,9 @@ def validate_contracts(root=ROOT):
assert manifest['canonical_url'] in citation, 'Citation URL mismatch'
for record in manifest['authors']:
assert record['name'] in (root/'AUTHOR.md').read_text(encoding='utf-8'), 'Author notice mismatch'
assert 'Copyright (c) 2026 Eddie Soehnel' in (root/manifest['rights']['license_file']).read_text(encoding='utf-8'), 'License attribution mismatch'
license_text = (root/manifest['rights']['license_file']).read_text(encoding='utf-8')
assert re.search(r'Copyright \(c\) \d{4}', license_text), 'Missing copyright notice'
assert any(record['name'] in license_text for record in manifest['authors']), 'License attribution mismatch'
ids=[item['content_id'] for item in index['items']]
paths=[item['path'] for item in index['items']]
assert len(ids)==len(set(ids)) and len(paths)==len(set(paths)), 'Duplicate content identity/path'
@@ -46,6 +48,26 @@ def validate_contracts(root=ROOT):
return {'version':version,'license':manifest['rights']['license'],'indexed_documents':len(ids)}
def validate_public_template(root=ROOT):
"""Bounded repository hygiene checks; not a general PII detector."""
operational_roots = {'tasks', 'task-records', 'runtime', 'private', 'recordings', 'structured'}
generated_names = {'media-intake.json', 'structure-plan.json', 'build-receipt.json', 'approval.json'}
text_suffixes = {'.md', '.py', '.json', '.txt', '.vtt', '.cff'}
machine_path = re.compile(r'(?<![A-Za-z0-9])[A-Za-z]:[\\/]|/(?:Users|home)/[A-Za-z0-9_.-]+/')
checked = 0
for path in root.rglob('*'):
rel = path.relative_to(root)
if not path.is_file() or set(rel.parts) & SKIP:
continue
assert rel.parts[0] not in operational_roots and not rel.parts[0].startswith('structured-final'), 'Operational records in public template: ' + rel.as_posix()
assert path.name not in generated_names and not path.name.endswith(('.ticket.json', '.receipt.json', '.log')), 'Recording-specific output in public template: ' + rel.as_posix()
if path.suffix in text_suffixes or path.name in {'LICENSE', '.gitignore', '.gitattributes', 'VERSION'}:
text = path.read_text(encoding='utf-8-sig')
assert not machine_path.search(text), 'Absolute machine path in public template: ' + rel.as_posix()
checked += 1
return {'public_template_files': checked}
def check():
files = [p for p in ROOT.rglob('*') if p.is_file() and not (set(p.relative_to(ROOT).parts) & SKIP)]
count = {'json': 0, 'markdown_links': 0, 'schema_refs': 0, 'python': 0}
@@ -99,7 +121,7 @@ def check():
errors.append('Missing manifest path: ' + name)
if errors:
raise ValueError('\n'.join(errors))
print(json.dumps({'valid': True, **count, **validate_contracts(ROOT)}, indent=2))
print(json.dumps({'valid': True, **count, **validate_contracts(ROOT), **validate_public_template(ROOT)}, indent=2))
if __name__ == '__main__':