code wiki / (root) / nx_wpt_ingest_gate.nx

nx_wpt_ingest_gate.nx

buildroot/runtime/nx_wpt_ingest_gate.nx

24343 B489 linesdepth 7pulls 10 transitivereach 0 importersview sourcekind gate/prooftopic wpt
docsdependenciesstructsconstsfunctions

about

nx_wpt_ingest_gate.nx -- IN-PROCESS gate for BR21 (nx_wpt_acquire_lib, carried by nx_wpt_ingest). THE ANTI-VACUITY TOOTH IS THE WHOLE POINT AND IT IS NAMED. The defect BR21 closes is that the hand acquisition path re-emitted every body through a TEXT TOOL ARGUMENT -- a NUL-terminated C string -- and html/syntax/parsing-html-fragments is the ENCODING-DETECTION suite, whose fixtures are UTF-16LE with a BOM and therefore carry a NUL as their FOURTH BYTE. An ASCII fixture round-trips perfectly through the broken path, so an ASCII fixture is a test the defect cannot fail. Every byte-exactness tooth below runs on a UTF-16LE-with-BOM body built at RUNTIME, and the fixture is first asserted to actually contain the NUL before any outcome is read: assert the fixture reached the condition BEFORE asserting the outcome. THE HASH ANCHOR COMES FROM OUTSIDE THE ESTATE. wa_verify_blob compares against the git blob object name GitHub declares. One tooth pins that arithmetic to f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f, which is git hash-object of the three bytes abc under git 2.49.0 -- a value this estate did not choose and cannot influence. Without it, computing a digest with swhid and then checking it with swhid would prove plumbing and call it correctness. SCOPE, STATED: this gate is OFFLINE by construction. It proves the manifest parser, the dual verification, the raw write, the read-back compare, the pin rule, the name allowlist, the completeness conjunction and the manifest/marker emit. It does NOT prove the transport -- that is nx_https_fetch_follow's subject, and the end-to-end proof is the live re-ingest reproducing corpus_sha16 54e90b086e0c6530 and 1819a1dcd3030f03, recorded on browser.plan, not here. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_wpt_acquire_lib.nx nx_wpt_ingest_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_wpt_acquire_lib.nx

imported by: nobody (leaf or entry point)

structs

none

consts

30const GT_DIR: *u8 = "/tmp/wsp_gate"
31const GT_FIX_CAP: i64 = 65536
32const GT_JSON_CAP: i64 = 65536
33const GT_BOM0: i64 = 255
34const GT_BOM1: i64 = 254
35const GT_FIX_LEN: i64 = 72 // DERIVED: 2 BOM bytes + 2 bytes per char of a 35-char title
36const GT_FIX_CSTR: i64 = 3 // DERIVED: BOM, BOM, first char -- then the NUL a C string stops at
37const GT_NUMBUF: i64 = 64 // DERIVED: a 64-bit decimal is at most 20 digits, plus a sign and a NUL
38const GT_SIZE_A: i64 = 1204 // the size GitHub declares for DOMTokenList-Iterable.html at the pin
39const GT_SIZE_B: i64 = 1205 // GT_SIZE_A + 1: the nearest neighbour, so the renderer cannot be a constant
40const GT_DIGITS_A: i64 = 5 // DERIVED: one char for the zero, plus the four digits of GT_SIZE_A
41const GT_DIGITS_B: i64 = 4 // DERIVED: the digit count of GT_SIZE_B

functions

45func gt_utf16le(d: *u8) -> i64
61func gt_q(d: *u8, o: i64) -> i64 { d[o] = 34 as u8; return o + 1 }
62func gt_ch(d: *u8, o: i64, c: i64) -> i64 { d[o] = c as u8; return o + 1 }
63func gt_kv(d: *u8, o: i64, k: *u8, v: *u8) -> i64
76func gt_kn(d: *u8, o: i64, k: *u8, v: i64) -> i64
89func gt_rec(d: *u8, o: i64, name: *u8, sha: *u8, size: i64, typ: *u8, with_sha: i64) -> i64
112func gt_path(out: *u8, leaf: *u8) -> i64
119func gt_exists(path: *u8) -> i64
125func gt_zero(rep: *i64) -> i64 { var i: i64 = 0; while i < WA_R_SLOTS { rep[i] = 0; i = i + 1 } return 0 }
127func gt_blobsha(data: *u8, n: i64, out: *u8) -> i64
136func gt_hexeq(a: *u8, b: *u8) -> i64
142func main() -> i64