interplane.Get Omega
Read in your language

aienos.com

Source of www.aienos.com, served from my own hardware

Brought by drakestapleton

branch main Branches Tags History

aienos.com / scripts / test-project-links.py

36 lines · 2216 bytes Raw Blame History
1#!/usr/bin/env python3
2"""Public navigation oracle. Examples and archived source provenance stay text."""
3from html.parser import HTMLParser
4from pathlib import Path
5from urllib.parse import urlsplit
6import sys,re
7class Links(HTMLParser):
8 def handle_starttag(self,tag,attrs):
9 for key,value in attrs:
10 if key=='href' and value:
11 host=(urlsplit(value).hostname or '').lower()
12 assert host not in ('github.com','www.github.com'),f'GitHub navigation remains: {value}'
13 assert not (host=='interplane.io' and re.search(r'/issues/[0-9]+(?:[?#].*)?$',value)),f'Unmapped GitHub issue number: {value}'
14 assert not re.search(r'&(#[0-9]+|#x[0-9a-fA-F]+|[A-Za-z]+);',value),f'href escaped twice (an entity survives decoding): {value}'
15def check(source):Links().feed(source)
16root=Path(sys.argv[1]);pages=list(root.rglob('*.html'))
17# The English site writes 92 HTML files (main a0bb31a7); the old floor of 100 counted the retired /zh-CN/ copies.
18assert len(pages)>=92,'missing or incomplete site output'
19for page in pages:check(page.read_text())
20try:check('<a href="https://github.com/aien-dev/omega">source</a>')
21except AssertionError:pass
22else:raise AssertionError('negative control accepted forbidden navigation')
23try:check('<a href="https://interplane.io/drakestapleton/omega-mv/blob/main/docs/OMEGA.md&amp;&#35;35;1-the-parts">source</a>')
24except AssertionError:pass
25else:raise AssertionError('negative control accepted a twice-escaped href')
26print(f'PROJECT-LINKS PASS: {len(pages)} HTML pages, zero GitHub hrefs, no twice-escaped href, planted-link negative controls refused')
27
28spark=(root/"spark/index.html").read_text()
29kept = ["NVIDIA/open-gpu-kernel-modules", "src/common/sdk/nvidia/inc/nvos.h", "lines 1114 to 1118",
30 "src/common/sdk/nvidia/inc/class/clc96f.h", "line 72", "580.173.02"]
31for needle in kept:
32 assert needle in spark, "external citation provenance retained as text: " + needle
33assert "https://github.com/NVIDIA" not in spark, "link policy: NVIDIA citation stays text, not a GitHub URL"
34try:check('<a href="https://interplane.io/drakestapleton/omega-mv/issues/515">source</a>')
35except AssertionError:pass
36else:raise AssertionError("negative control accepted unmapped issue number")