Add frozen TikZRefinery demo baseline and build pipeline
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
from pathlib import Path
|
||||
import hashlib,json,re,subprocess
|
||||
from collections import Counter
|
||||
from pypdf import PdfReader
|
||||
root=Path(__file__).resolve().parents[2];task=Path(__file__).parent
|
||||
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
before=json.loads((task/'packages-before.json').read_text(encoding='utf-8-sig'))
|
||||
package=root/'code/packages/0.1.3-alpha';allowed={'TikZRefinery.exe','build-info.json','package-manifest.json','README.md','README.txt','shape-plugins/tkr_rectangle.dll'}
|
||||
preserved=[]
|
||||
for item in before:
|
||||
p=Path(item['path'])
|
||||
if package in p.parents and p.relative_to(package).as_posix() in allowed:continue
|
||||
assert p.exists() and sha(p)==item['sha256'],p
|
||||
preserved.append(item)
|
||||
manifest=json.loads((package/'package-manifest.json').read_text())
|
||||
for item in manifest['files']:assert sha(package/item['path'])==item['sha256'],item
|
||||
for item in manifest['sourceFiles']:assert sha(root/item['path'])==item['sha256'],item
|
||||
registries={}
|
||||
alltex='\n'.join(p.read_text(encoding='utf-8-sig') for p in (root/'documents/latex').glob('*.tex'))
|
||||
for macro,expected in [('RequirementID',111),('TestCaseID',82),('VerificationID',111),('UserStoryID',11),('UseCaseID',9),('ValidationID',11)]:
|
||||
ids=re.findall(r'\\'+macro+r'\{([^}]+)\}',alltex)
|
||||
assert len(ids)==expected,(macro,len(ids));assert len(ids)==len(set(ids)),macro
|
||||
registries[macro]=len(ids)
|
||||
pdfchecks={}
|
||||
for edition in ['TikZRefinery','TikZRefinerySubmission']:
|
||||
p=task/f'report/{edition}/{edition}.pdf';r=PdfReader(p);names=r.named_destinations;bad=[];links=0
|
||||
for i,page in enumerate(r.pages):
|
||||
for ref in page.get('/Annots',[]):
|
||||
a=ref.get_object();d=a.get('/Dest');action=a.get('/A')
|
||||
if action and action.get('/S')=='/GoTo':d=action.get('/D')
|
||||
if d is None:continue
|
||||
links+=1
|
||||
if isinstance(d,str) and d not in names:bad.append((i+1,str(d)))
|
||||
assert not bad,bad
|
||||
log=p.with_suffix('.log').read_text(errors='replace')
|
||||
issues=re.findall(r'^.*(?:Overfull|undefined references|undefined citations|duplicate ignored|destination with the same identifier|LaTeX Error).*$' ,log,re.M)
|
||||
assert not issues,issues
|
||||
pdfchecks[edition]=dict(pages=len(r.pages),internalLinks=links,namedDestinations=len(names),issues=issues)
|
||||
protected=json.loads((root/'documents/assets/sidebar-design-2026-11-23/protected-before.json').read_text(encoding='utf-8-sig'))
|
||||
protected_checked=[]
|
||||
for item in protected:
|
||||
p=Path(item['path']);s=p.as_posix().lower()
|
||||
if '/code/packages/0.1.3-alpha/' in s:continue
|
||||
if any(x in s for x in ['/code/packages/','/code/examples/','/documents/submissions/week','/documents/assets/plugin-extraction-']):
|
||||
assert p.exists() and sha(p)==item['sha256'],p;protected_checked.append(item)
|
||||
result=dict(date='2026-11-23',preservedPackageFiles=len(preserved),protectedHistoricalFiles=len(protected_checked),packageFilesChecked=len(manifest['files']),packageSourceFilesChecked=len(manifest['sourceFiles']),registries=registries,pdfs=pdfchecks,limits='Product acceptance, catalogue/creation and shared-service refactor remain pending; no commit/push/upload.')
|
||||
evidence=root/'code/tests/evidence/sidebar-shell-2026-11-23';(evidence/'final-checks.json').write_text(json.dumps(result,indent=2)+'\n')
|
||||
print(json.dumps(result,indent=2))
|
||||
Reference in New Issue
Block a user