code wiki / (root) / nx_ppp_probe.nx

nx_ppp_probe.nx

buildroot/runtime/nx_ppp_probe.nx

51178 B901 linesdepth 21pulls 155 transitivereach 0 importersview sourcekind probe
docsdependenciesstructsconstsfunctions

about

nx_ppp_probe.nx -- PERSON / PRODUCT / PLACE probe: ONE ruler, run on OUR live surface AND on each rival's live surface, so a /compare page can say how to build a better site than the competitor from a measurement instead of an opinion (operator 2026-08-24: "we need to know the person, product, and place ... competing on person via privacy and superior cx, product as a superior product ... place ... ease of navigation and ability to accomplish the desired task"). WHAT IT MEASURES, from the bytes a first visitor receives (HTML body over the sovereign TLS stack + the HTTP response headers) -- the same envelope for every subject, which is what makes the head-to-head fair: PERSON (privacy + CX) third-party asset hosts, third-party SCRIPT hosts, known tracker markers (tag manager, analytics, pixel, session-replay, ad networks, fingerprinting), consent-banner markers, cookie-less analytics markers, Set-Cookie count, Permissions-Policy, the 5 security headers (composes nx_uiq_wire_lib uw_audit -- one ruler for headers, never a second copy). PRODUCT (design quality + longevity) the design-hygiene score of nx_ui_audit (forked, /12), computed WCAG contrast over the page's real color tokens (composes nx_uiq_color uiq_audit_buf in-process), the static Core-Web-Vitals predictor of nx_uiq_perf (forked: render-blocking css/js, unsized media), script tags, inline-JS share of the page, noscript, dark-mode + reduced-motion media queries, canonical link, doctype, page weight. PLACE (findability + task) nav / main / footer landmarks, skip link, on-site search, breadcrumb, exactly-one h1, aria-current, link count and internal-link count, lang, viewport, title. SCORE: each axis is a permil computed by the DECLARED rules in pp_score_* below -- every rule is a count against a published bar (WCAG 2.2 landmarks and skip links, NN/g search + breadcrumb, web.dev CWV predictors, OWASP secure headers, the Markup Blacklight tracker classes) so it can be argued with, and the raw counts are printed beside the score so nobody has to trust the arithmetic. THIRD STATE: a sub-measure the probe could not observe (a fork that returned nothing, headers not captured) is printed as -1 and named in "unobserved" -- it scores ZERO for that rule and the page says so, never a silent acquittal (abstain-never-acquit). HONEST ENVELOPE: static HTML + headers, no render, no script execution. A client-rendered app is graded on what it ships to a no-JS first visitor -- which is the progressive-enhancement bar itself, stated on the page. Registrable domain = last two labels (wrong for co.uk-class suffixes; declared). nx_ppp_probe url <url> [connect-host:port] -> one JSON object on stdout nx_ppp_probe domain <dom> -> reads knowledge/compare/<dom>.ppp rows surface|<col>|<label>|<url>|<connect or -> probes each, writes knowledge/compare/<dom>.pppstate nx_ppp_probe --kat -> fixture self-test (bite-proven both directions) exit: 0 ok | 1 kat failed | 2 usage | 4 fetch failed (url verb) license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_tool_run.nx nx_https_fetch_follow.nx nx_trust_store_load_from_certdata. nx_https_url_connect.nx nx_uiq_color.nx nx_uiq_wire_lib.nx nx_ppp_probe.nx

imports: nx_syscalls.nxnx_tool_run.nxnx_https_fetch_follow.nxnx_trust_store_load_from_certdata.nxnx_https_url_connect.nxnx_uiq_color.nxnx_uiq_wire_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main pp_w sys_write sys_exit pp_kat pp_measure sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ pp_lower pp_lc pp_host_of pp_len pp_find pp_len ↻ pp_cat pp_find ↻ pp_count pp_len ↻ pp_has pp_count ↻ uw_audit uw_hdr_end uw_status uw_has uw_len uw_lc uw_val_has

structs

none

consts

45const PP_BODY_CAP: i64 = 4194304 // one page body reserve (largest rival measured: 792 KB); brim announces
46const PP_CERT_CAP: i64 = 4194304 // Mozilla certdata reserve, as nx_ui_audit sizes it
47const PP_FORK_CAP: i64 = 262144 // a forked ruler's stdout, unknowable in advance
48const PP_HDR_CAP: i64 = 2097152 // nx_https_get prints headers AND body; headers are read from the head
49const PP_HOSTS_MAX: i64 = 128 // distinct hosts tracked per page; brim announces
50const PP_HOST_W: i64 = 128 // one host slot
51const PP_OUT_CAP: i64 = 32768 // one surface's JSON
52const PP_MIN_BYTES: i64 = 1024 // under this a body is a redirect stub or a co-squat 404, not a page
53const PP_FORK_MS: i64 = 60000 // a forked ruler that has not answered in a minute is UNOBSERVED
54const PP_MAX_SURFACES: i64 = 16
55const PP_ROW_CAP: i64 = 2048
56const PP_STATE_CAP: i64 = 524288
57const PP_NAME_CAP: i64 = 512
58const PP_TMP_BODY: *u8 = "/tmp/nx_ppp_body.html"
59const PP_LINE_CAP: i64 = 4096
61const PP_ATTRPAT_CAP: i64 = 256
63const PP_NUMBUF_CAP: i64 = 32

functions

65func pp_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 3: pp_katpp_domainmain calls 1: sys_write
66func pp_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
67func pp_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } d[p] = 0 as u8; return p }
68func pp_catn(d: *u8, o: i64, v: i64) -> i64
called by 3: pp_kvpp_domainmain calls 1: sys_mmap
81func pp_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] == b[i] { if a[i] == (0 as u8) { return 1 } i = i + 1 } return 0 }
called by 2: pp_domainmain
82func pp_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: pp_lower
84func pp_count(buf: *u8, n: i64, pat: *u8) -> i64
called by 2: pp_haspp_measure calls 1: pp_len
97func pp_has(buf: *u8, n: i64, pat: *u8) -> i64 { if pp_count(buf, n, pat) > 0 { return 1 } return 0 }
called by 2: pp_has_attrpp_measure calls 1: pp_count
107func pp_has_attr(buf: *u8, n: i64, attr: *u8, val: *u8) -> i64
called by 1: pp_measure calls 3: sys_mmappp_catpp_has
121func pp_find(buf: *u8, n: i64, from: i64, pat: *u8) -> i64
135func pp_json_int(buf: *u8, n: i64, key: *u8) -> i64
called by 1: pp_probe_url calls 2: pp_findpp_len
152func pp_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
154func pp_elf(name: *u8, out: *u8) -> i64
called by 1: pp_fork calls 2: pp_catpp_exists
172func pp_write_atomic(path: *u8, buf: *u8, n: i64) -> i64
184func pp_lower(src: *u8, n: i64, dst: *u8) -> i64
called by 1: pp_measure calls 1: pp_lc
191func pp_host_of(url: *u8, host: *u8, reg: *u8) -> i64
called by 1: pp_measure calls 3: pp_lenpp_findpp_cat
221func pp_same_site(host: *u8, reg: *u8) -> i64
233func pp_in_script_tag(lb: *u8, p: i64) -> i64
247func pp_hosts(lb: *u8, n: i64, reg: *u8, out: *i64, names: *u8) -> i64
311func pp_trackers(lb: *u8, n: i64, names: *u8) -> i64
360func pp_cookieless(lb: *u8, n: i64) -> i64
368func pp_inline_js(lb: *u8, n: i64) -> i64
385func pp_score_person(tp_hosts: i64, tp_script: i64, trackers: i64, consent: i64, setcookie: i64, sec: i64, permpol: i64) -> i64
397func pp_score_product(design: i64, cfails: i64, ctokens: i64, bcss: i64, bjs: i64, unsized: i64, scripts: i64, jsperm: i64, noscript: i64, dark: i64, motion: i64, canonical: i64, doctype: i64) -> i64
413func pp_score_place(nav: i64, main: i64, footer: i64, skip: i64, search: i64, crumb: i64, h1: i64, links: i64, internal: i64, lang: i64, viewport: i64, title: i64, current: i64) -> i64
430func pp_pat_skip(out: *u8) -> i64
436func pp_pat_skip2(out: *u8) -> i64
447func pp_measure(body: *u8, n: i64, hdr: *u8, hn: i64, url: *u8, design: i64, bcss: i64, bjs: i64, unsized: i64, m: *i64, tnames: *u8, hnames: *u8) -> i64
527func pp_kv(d: *u8, o: i64, k: *u8, v: i64) -> i64
530func pp_ks(d: *u8, o: i64, k: *u8, v: *u8) -> i64
538func pp_emit_json(out: *u8, col: *u8, label: *u8, url: *u8, m: *i64, tnames: *u8, hnames: *u8, unobs: *u8) -> i64
598func pp_fork(name: *u8, a1: *u8, a2: *u8, out: *u8, cap: i64) -> i64
612func pp_probe_url(url: *u8, connect: *u8, col: *u8, label: *u8, store: *TrustStore, out: *u8) -> i64
690func pp_store() -> *TrustStore
698func pp_kat() -> i64
769func pp_split(line: *u8, fld: *i64, maxf: i64) -> i64
780func pp_domain(dom: *u8) -> i64
863func main(argc: i64, argv: *i64) -> i64