Add frozen TikZRefinery demo baseline and build pipeline
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good

This commit is contained in:
2026-11-25 22:46:33 -05:00
parent 6064cce05e
commit 27b82c169e
456 changed files with 66509 additions and 0 deletions
@@ -0,0 +1,54 @@
from pathlib import Path
import re,json
from pypdf import PdfReader
import pypdfium2 as pdfium
from PIL import Image,ImageDraw
root=next(p for p in Path(__file__).resolve().parents if (p/'AGENTS.md').is_file())
task=root/'work/undo-redo-report-0.1.4'
out=task/'review';out.mkdir(exist_ok=True)
# Content checks use authored TeX. PDF access here is metadata and raster rendering.
focus=['Figure:PlannedTransactionClasses','Figure:TransactionDetails','Figure:TransactionActivity','Figure:TransactionSequence','Figure:UC004Diagram','Figure:CurrentClasses','Figure:CurrentPluginDeployment','Section:TransactionDesign','Section:PlannedTransactionClasses','Section:ReviewedOperations','Section:AIChangeImpact','Section:AIGuideChecklist','Section:AIVersionPolicy','Section:UndoRedoReportLog','Table:AIAgentRequirements','Chapter:UseCases','Chapter:Tests','Chapter:SoftwareArchitecture']
selections={}
for edition in ['TikZRefinerySubmission','TikZRefinery']:
base=task/'build'/edition;pdf=base/(edition+'.pdf')
if not pdf.exists():continue
reader=PdfReader(pdf);labels=reader.page_labels
aux='\n'.join(p.read_text(errors='replace') for p in base.glob('*.aux'))
locations=dict((m[1],m[3]) for m in re.finditer(r'\\newlabel\{([^}]+)\}\{\{([^}]*)\}\{([^}]*)\}',aux))
selected={i for i,label in enumerate(labels) if not label.isdigit()}
for label in focus:
if label not in locations:continue
page=labels.index(locations[label])
selected.update(range(max(0,page-1),min(len(labels),page+2)))
# The changed levels/entry wording follows the complete planned-test register.
for name,printed in locations.items():
if name.endswith(':TC-082'):
page=labels.index(printed);selected.update(range(page,min(len(labels),page+5)))
# All affected roadmap rows and status wording, plus test oracle TC-039.
for key in ['RPT-029','RPT-033','TC-039','VER-014','VER-063']:
for name,printed in locations.items():
if name.endswith(':'+key):
page=labels.index(printed);selected.update(range(max(0,page-1),min(len(labels),page+2)))
if edition=='TikZRefinery':
for begin,end in [('Chapter:AIAgentRequirements','Chapter:AIAgentGuide')]:
if begin in locations and end in locations:
selected.update(range(labels.index(locations[begin]),labels.index(locations[end])))
doc=pdfium.PdfDocument(str(pdf));thumbs=[];changed=[];prefix='dev' if edition=='TikZRefinery' else 'sub'
for i in sorted(selected):
im=doc[i].render(scale=1.35).to_pil()
previous=out/f'{prefix}-{i+1}.png'
if previous.exists():
before=Image.open(previous)
if before.size!=im.size or before.convert('RGB').tobytes()!=im.convert('RGB').tobytes():changed.append(i+1)
before.close()
else:changed.append(i+1)
im.save(previous)
thumb=im.copy();thumb.thumbnail((540,700));tile=Image.new('RGB',(560,735),'#dddddd')
tile.paste(thumb,((560-thumb.width)//2,25));ImageDraw.Draw(tile).text((8,7),f'{prefix} physical {i+1} / label {labels[i]}',fill='black');thumbs.append(tile)
for start in range(0,len(thumbs),6):
sheet=Image.new('RGB',(1120,2205),'white')
for n,tile in enumerate(thumbs[start:start+6]):sheet.paste(tile,((n%2)*560,(n//2)*735))
sheet.save(out/f'{prefix}-sheet-{start//6+1}.jpg',quality=86)
selections[edition]=dict(pages=[dict(physical=i+1,label=labels[i]) for i in sorted(selected)],changedSincePreviousRender=changed,figures={label:dict(physical=labels.index(locations[label])+1,label=locations[label]) for label in focus if label in locations})
(out/'selection.json').write_text(json.dumps(selections,indent=2)+'\n')
print(json.dumps({edition:dict(rendered=len(info['pages']),changedSincePreviousRender=info['changedSincePreviousRender'],figures={key:value['physical'] for key,value in info['figures'].items() if key.startswith('Figure:')}) for edition,info in selections.items()},indent=2))