nx_wpt_runner.nx
buildroot/runtime/nx_wpt_runner.nx
about
nx_wpt_runner.nx -- BR1 v3: THE SOVEREIGN WPT HARNESS with TIME-SPINE TELEMETRY (2026-08-19).
v1 ran real web-platform-tests through the browser's own JS+DOM lane. v2 fixed this harness's own
overclaim (assert_throws any-throw) and made async_test synchronous with arithmetic incompleteness.
v3 integrates the August-2026 test-intelligence field, measured against it honestly:
- CONTENT-ADDRESSED RUNS (the Bazel/TIA class, but EXACT): a run is keyed by
(engine_sha = sha256 of this very binary, corpus_sha = sha256 over the SORTED name+bytes of
every .html in the directory). Same key => the result CANNOT differ (the engine is
bit-deterministic), so re-running is refused with the prior row as the answer (--force
overrides). Develocity-class predictive selection is PROBABILISTIC ("99% of failures");
ours is an invariant, not a bet -- and it is only available because determinism was proven
first (same bytes twice => bit-identical render).
- THE TIME SPINE: every counted run appends ONE TSV row to the history file -- results
documented against time, so two rows say "and it is improving/regressing" where one row
can only say a level. Schema mapped onto the OpenTelemetry CI/CD semantic conventions
(v1.27+ cicd.* / test.* attribute families) so an OTLP exporter is a future formatter,
not a redesign: epoch_s(cicd.pipeline.run start) dir(test.suite name)
engine_sha16(service.version) corpus_sha16(vcs.ref analog) counters(test.case results)
dur_ms(pipeline duration) verdict.
- REGRESSION DETECTION: against the newest prior row with the SAME corpus (engine free to
differ -- that comparison is the point), pass-down or fail-up flags REGRESSION and exits 4
so a beat can alarm. Improvement is reported and exits 0.
- FLAKINESS REFUTED, NOT MANAGED (--twice): the field marks a test FLAKY when it both fails
and passes across runs and then works around it; our engine is deterministic, so the
whole directory runs twice and ANY divergence in any per-file counter is a REAL BUG
(exit 5 DETERMINISM-VIOLATION), never noise to be tolerated.
- CONTROLS FIRST, ALWAYS (unchanged law): runtime-synthesized neg+pos control; a harness
that cannot see a failure counts nothing. All buffers derived from inputs, no fixed caps.
usage: nx_wpt_runner <dir-of-.html-tests> [historyfile] [--force] [--twice]
ENTRY: wpt_run(dir, histpath, force, twice) IS the harness (the /compare/browser BR1 contract symbol);
main only parses argv and delegates, so the contract names the code that does the work,
never a stub wearing its name (re-keyed 2026-08-23: the board had watched `wpt_run` while
the harness lived in main + wpt_run_page, so a LANDED rung ranked #1 OPEN for five days).
exit: 0 counted (incl improvement) | 2 harness unproven | 3 usage | 4 REGRESSION | 5 NONDETERMINISM
license_tier: ORIGINAL expect_exit: 0
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_js_eval.nxnx_sha256.nxnx_wpt_spine.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 50 | const WPT_NAMEBUF_CAP: i64 = 1048576 |
| 51 | const WPT_MAX_FILES: i64 = 8192 |
| 52 | const WPT_PATH_CAP: i64 = 4096 |
| 53 | const WPT_ROW_CAP: i64 = 2048 |
| 54 | const WPT_SERIALIZE_HEADROOM: i64 = 65536 |
functions
| 57 | func wr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 58 | func wrn(v: i64) -> i64 |
| 65 | func scat(dst: *u8, off: i64, src: *u8) -> i64 { var i: i64 = 0; while src[i] != (0 as u8) { dst[off+i] = src[i]; i = i + 1 } return off + i } |
| 66 | func scatn(dst: *u8, off: i64, src: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { dst[off+i] = src[i]; i = i + 1 } return off + n } |
| 67 | func catnum(dst: *u8, off: i64, v: i64) -> i64 |
| 75 | func ends_with(s: *u8, n: i64, suf: *u8, sn: i64) -> i64 |
| 81 | func count_marks(hay: *u8, n: i64, needle: *u8) -> i64 |
| 93 | func streqz(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } |
| 100 | func wpt_shim() -> *u8 |
| 104 | func wpt_shim_tail() -> *u8 |
| 121 | func wpt_run_page(html: *u8, hlen: i64, out: *i64) -> i64 |
| 158 | func wpt_hist_default() -> *u8 |
| 162 | func main(argc: i64, argv: *i64) -> i64 |
| 215 | func wpt_run(dir: *u8, histpath: *u8, force: i64, twice: i64) -> i64 |