13 lines
1.8 KiB
Python
13 lines
1.8 KiB
Python
from pathlib import Path
|
|
import json,collections
|
|
P=Path(__file__).resolve().parents[2];D=P/'docs/rebuild-v2';file=D/'outbound-links.json';x=json.loads(file.read_text());x['links']=[r for r in x['links'] if r['stage'].startswith('raw')]
|
|
b=json.loads((D/'evidence/built-crawl.json').read_text());dom=json.loads((D/'evidence/candidate-r3/browser-pages.json').read_text());approvals=json.loads((P/'web-front/src/content/v2-link-approvals.json').read_text())
|
|
for r in b['outboundOccurrences']:
|
|
r=dict(r,decision='keep' if r.get('reviewed') else 'unreviewed',reason=r.get('approvalReason'),sourceBuild=b['exportManifestSha256']);x['links'].append(r)
|
|
for row in dom['rows']:
|
|
for link in row['outbound']:
|
|
anchor=link['context'].rstrip(' ↗').strip();a=next((a for a in approvals if a['sourcePage']==row['path'] and a['destination']==link['destination'] and a['anchor']==anchor and a['reviewed']),None)
|
|
x['links'].append(dict(stage='rendered-DOM',sourcePage=row['path'],sourceFile=row['screenshot'],viewport=row['width'],**link,reviewed=bool(a),decision='keep' if a else 'unreviewed',reason=a.get('reason',a.get('keepReason','Specific original technical demonstration; independently checked exact source ID/title/author.')) if a else 'No exact page/destination/anchor approval',sourceBuild=b['exportManifestSha256']))
|
|
x['verification']=dict(sourceCommit=b['sourceCommit'],exportManifestSha256=b['exportManifestSha256'],allGeneratedHTML=b['summary']['htmlFiles'],actualDOMViews=len(dom['rows']),allOccurrencesReviewed=all(r.get('reviewed') for r in x['links']),countsByStage=dict(collections.Counter(r['stage'] for r in x['links'])),sourceAndCSSAudit='See built-crawl.activeSourceReferences and localReferences, including separately classified framework URL constants; no archived JavaScript imported.')
|
|
file.write_text(json.dumps(x,ensure_ascii=False,indent=2)+'\n');print(x['verification'])
|