Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane.io/blob/main/evidence/ONBOARDING-L642/qualify.py # interplane.io Source of interplane.io: a Rust generator that renders the page from the protocol repository's public record, deployed hourly from the Spark. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane.io / evidence / ONBOARDING-L642 / qualify.py` 115 lines ยท 7604 bytes Raw Blame History 1 #!/usr/bin/env python3 2 """Qualify actual generated routes and replay the literal rendered Quick Start. 3 Run at repository root after cargo build/build-dist. No deployment or model use. 4 """ 5 import gzip, hashlib, json, os, re, shutil, signal, subprocess, tempfile 6 from html.parser import HTMLParser 7 from pathlib import Path 8 from typing import Any 9 ROOT=Path(__file__).resolve().parents[2] 10 OUT=Path(__file__).resolve().parent 11 DIST=ROOT/'dist' 12 BINARY=ROOT/'target/debug/site-builder' 13 ROUTES=['/','/quick-start/','/concepts/','/adapter/','/conformance/','/status/'] 14 15 def save(name,data): 16 if isinstance(data,str): data=data.encode() 17 (OUT/(name+'.gz')).write_bytes(gzip.compress(data,mtime=0)) 18 return {'file':name+'.gz','raw_sha256':hashlib.sha256(data).hexdigest(),'raw_bytes':len(data)} 19 def run(args,cwd=ROOT,timeout=180): 20 proc=subprocess.Popen(args,cwd=cwd,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,start_new_session=True) 21 try: raw=proc.communicate(timeout=timeout)[0] 22 except subprocess.TimeoutExpired: 23 os.killpg(proc.pid,signal.SIGTERM) 24 try: raw=proc.communicate(timeout=5)[0] 25 except subprocess.TimeoutExpired: 26 os.killpg(proc.pid,signal.SIGKILL); raw=proc.communicate()[0] 27 return 124,raw 28 return proc.returncode,raw 29 class Page(HTMLParser): 30 def __init__(self,text): 31 super().__init__(convert_charrefs=True) 32 self.links=[]; self.codes=[]; self.code=None; self.title=False; self.title_text=''; self.meta=[]; self.canonical=[] 33 self.feed(text) 34 def handle_starttag(self,tag,attrs): 35 attrs=dict(attrs) 36 if tag=='a': self.links.append(attrs.get('href')) 37 if tag=='meta': self.meta.append(attrs) 38 if tag=='link' and attrs.get('rel')=='canonical': self.canonical.append(attrs.get('href')) 39 if tag=='title': self.title=True 40 if tag=='code': self.code=[attrs,''] 41 def handle_data(self,data): 42 if self.title:self.title_text+=data 43 if self.code is not None:self.code[1]+=data 44 def handle_endtag(self,tag): 45 if tag=='title':self.title=False 46 if tag=='code' and self.code is not None:self.codes.append(self.code);self.code=None 47 48 def main(): 49 manifest:dict[str,Any]={'source_commit':subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT,text=True).strip(), 50 'binary_sha256':hashlib.sha256(BINARY.read_bytes()).hexdigest(), 51 'facts_sha256':hashlib.sha256((DIST/'facts.json').read_bytes()).hexdigest(), 52 'scope':'static site and pinned scripted CPU reference; no deployment, model, GPU or general security qualification'} 53 shutil.copyfile(DIST/'facts.json',OUT/'facts-snapshot.json') 54 pages={route:Page((DIST/route.strip('/')/'index.html').read_text()) for route in ROUTES} 55 for route,p in pages.items(): 56 assert p.canonical==['https://interplane.io'+route],(route,p.canonical) 57 assert all(r in p.links for r in ROUTES),(route,p.links) 58 assert [m for m in p.meta if m.get('name')=='description'],route 59 assert len({p.title_text for p in pages.values()})==6 60 assert len({next(m['content'] for m in p.meta if m.get('name')=='description') for p in pages.values()})==6 61 manifest['routes']=ROUTES 62 with tempfile.TemporaryDirectory(prefix='L642-controls-',dir=os.environ['TMPDIR']) as temp: 63 dist=Path(temp)/'dist';shutil.copytree(DIST,dist) 64 rc,raw=run([str(BINARY),'verify',str(dist)]);assert rc==0,raw 65 controls=[] 66 for route in ROUTES: 67 file=dist/route.strip('/')/'index.html';original=file.read_text() 68 url='https://interplane.io'+route 69 mutations={ 70 'wrong-canonical':original.replace(f'rel="canonical" href="{url}"','rel="canonical" href="https://wrong.example/"'), 71 'wrong-title':original.replace('