Add approved Matthew through Caleb cards and production fixes
Add 19 approved card packages and Timothy revision v03, storing permanent binary assets through Git LFS while keeping generated review images local. Enable harness file polling and verify unchanged used fonts when archiving a previous approved card whose shared font manifest pin has become stale. Preserve the original acceptance manifest and archival verification evidence. Validation: 42 production tests, 9 harness test suites, TypeScript type check, Vite production build, and integrity checks for all 20 card packages passed.
This commit is contained in:
@@ -262,7 +262,43 @@ def refresh(directory,allow_approved=False):
|
||||
write(directory/'manifest.json',manifest)
|
||||
return manifest
|
||||
|
||||
def validate(directory):
|
||||
def verify_archival_fonts(directory,manifest):
|
||||
"""Verify an approved package's used fonts before archival, without repinning it."""
|
||||
if manifest['stage']!='approved' or (manifest.get('approval') or {}).get('by')!='user':
|
||||
raise ValueError('Only user-approved packages qualify for archival font verification')
|
||||
report_path=directory/'review/build-validation.json'
|
||||
if not report_path.is_file():raise ValueError('Missing historical font verification report')
|
||||
report=read(report_path)
|
||||
if (report.get('status')!='passed' or report.get('cardId')!=manifest['cardId']
|
||||
or report.get('revision')!=manifest['revision']
|
||||
or report.get('sharedFontManifestSHA256')!=manifest['sharedFontManifestSHA256']):
|
||||
raise ValueError('Historical font verification report does not match the acceptance')
|
||||
current_path=REPO/'fonts/manifest.json';current=read(current_path)
|
||||
for name,record in current['files'].items():
|
||||
path=REPO/'fonts'/name
|
||||
if Path(name).name!=name or not path.is_file() or digest(path)!=record['sha256']:
|
||||
raise ValueError(f'Changed shared font asset: {name}')
|
||||
fonts=report.get('typography',{}).get('fonts',[])
|
||||
roles=[font.get('role') for font in fonts]
|
||||
if not {'title','verse','reference'}.issubset(roles) or len(set(roles))!=len(roles):
|
||||
raise ValueError('Incomplete historical font-role evidence')
|
||||
verified=[]
|
||||
for font in fonts:
|
||||
role=font['role'];face=current.get('productionTypography',{}).get(role)
|
||||
if (not isinstance(face,dict) or font.get('path')!=str(Path('fonts')/face['file'])
|
||||
or font.get('weight')!=face['weight'] or font.get('fallbackUsed') is not False
|
||||
or font.get('missingGlyphs')!=[]):
|
||||
raise ValueError(f'Historical font role changed or unverified: {role}')
|
||||
path=REPO/font['path'];expected=current['files'].get(face['file'],{}).get('sha256')
|
||||
if font.get('sha256')!=expected or digest(path)!=font['sha256']:
|
||||
raise ValueError(f'Historical font changed: {role}')
|
||||
verified.append({key:font[key] for key in ['role','path','sha256','weight']})
|
||||
return {'policy':'unchanged-used-fonts-for-archival-only',
|
||||
'historicalManifestSHA256':manifest['sharedFontManifestSHA256'],
|
||||
'currentManifestSHA256':digest(current_path),
|
||||
'historicalBuildReportSHA256':digest(report_path),'verifiedFonts':verified}
|
||||
|
||||
def validate(directory,*,archival_fonts=False):
|
||||
manifest=read(directory/'manifest.json')
|
||||
if manifest['stage'] not in STAGES:raise ValueError('Unknown revision stage')
|
||||
for relative,record in manifest['files'].items():
|
||||
@@ -271,7 +307,9 @@ def validate(directory):
|
||||
sys.path.insert(0,str(REPO/'artifacts/layers'));from library import load_tier
|
||||
shared=manifest['sharedLayers'];loaded=load_tier(shared['tier'],shared['version'])
|
||||
if loaded['manifestSHA256']!=shared['manifestSHA256']:raise ValueError('Pinned shared layer manifest changed')
|
||||
if digest(REPO/'fonts/manifest.json')!=manifest['sharedFontManifestSHA256']:raise ValueError('Pinned shared font manifest changed')
|
||||
if digest(REPO/'fonts/manifest.json')!=manifest['sharedFontManifestSHA256']:
|
||||
if not archival_fonts:raise ValueError('Pinned shared font manifest changed')
|
||||
manifest['archivalFontVerification']=verify_archival_fonts(directory,manifest)
|
||||
exports=check_exports(directory,manifest['stage']!='art-review')
|
||||
for label,expected in exports.items():
|
||||
if read(directory/label/'manifest.json')!=expected:raise ValueError(f'Stale resolution manifest: {label}')
|
||||
@@ -320,7 +358,7 @@ def approve(card_id,revision,note):
|
||||
if any(path.exists() for path in sibling_archives):raise ValueError('Superseded revision history destination already exists')
|
||||
target=REPO/'artifacts/cards'/name;previous=None;archive=None
|
||||
if target.exists():
|
||||
previous=validate(target)
|
||||
previous=validate(target,archival_fonts=True)
|
||||
if previous['stage']!='approved':raise ValueError('Existing artifact is not an approved card')
|
||||
archive=base/'history'/f"accepted-{previous['revision']}"
|
||||
if archive.exists():raise ValueError('Previous acceptance archive already exists')
|
||||
@@ -334,6 +372,12 @@ def approve(card_id,revision,note):
|
||||
if target.exists():
|
||||
original_archive=archive_revision(target,REPO)
|
||||
relocate_revision(target,archive,previous.get('compatibilityAliases',[]))
|
||||
if previous.get('archivalFontVerification'):
|
||||
# Preserve the old pin and the exact acceptance manifest before relocation refresh.
|
||||
evidence=previous['archivalFontVerification']
|
||||
evidence['originalAcceptanceManifestSHA256']=digest(archive/'manifest.json')
|
||||
shutil.copy2(archive/'manifest.json',archive/'review/original-acceptance-manifest.json')
|
||||
write(archive/'review/archive-font-verification.json',evidence)
|
||||
refresh(archive,allow_approved=True);compact_revision(archive,'replaced by a newer accepted revision',original_archive)
|
||||
target=relocate_revision(source,target,aliases)
|
||||
manifest['stage']='approved';manifest['approval']={'by':'user','note':note};write(target/'manifest.json',manifest)
|
||||
|
||||
Reference in New Issue
Block a user