code wiki / (root) / nx_uxcx_grade_run.nx

nx_uxcx_grade_run.nx source

↩ module page · 59 lines · 2970 B

1// nx_uxcx_grade_run.nx -- sovereign UX/CX grader RUNNER. 2// 3// Reads the live library artifacts DIRECTLY via sys_read_file (the sovereign 4// syscall) -- no bash, no cp staging -- runs every byte-scan check in 5// nx_uxcx_grade.nx, and prints a per-check verdict + the permil. Built + run 6// by the WOMB (nx_sov_build_run.elf), the substrate's own build engine. 7// Paths point at the checkout carrying this session's fixes. 8 9import "nx_syscalls.nx" 10import "nx_runtime.nx" 11import "nx_uxcx_grade.nx" 12 13func uxr_puts(s: *u8) -> i64 { 14 return sys_write(1, s, uxg_len(s)) 15} 16 17func uxr_emit(label: *u8, ok: i64) -> i64 { 18 uxr_puts(label) 19 if ok == 1 { uxr_puts("PASS\n" as *u8) } 20 if ok != 1 { uxr_puts("FAIL\n" as *u8) } 21 return 0 22} 23 24func uxr_grade_tree(label: *u8, page_path: *u8, js_path: *u8) -> i64 { 25 let pl: *i64 = sys_mmap(8) as *i64 26 let jl: *i64 = sys_mmap(8) as *i64 27 pl[0] = 0 28 jl[0] = 0 29 let page: *u8 = sys_read_file(page_path, pl) 30 let js: *u8 = sys_read_file(js_path, jl) 31 uxr_puts(label) 32 uxr_puts("\n" as *u8) 33 if (page as i64) == 0 { uxr_puts(" -- cannot read index.html\n\n" as *u8); return 0 } 34 if (js as i64) == 0 { uxr_puts(" -- cannot read app.js\n\n" as *u8); return 0 } 35 let pn: i64 = pl[0] 36 let jn: i64 = jl[0] 37 uxr_emit(" escaping (no & double-encode) : " as *u8, uxg_escaping_ok(page, pn)) 38 uxr_emit(" mobile (width=device-width) : " as *u8, uxg_viewport_ok(page, pn)) 39 uxr_emit(" skip-link (bypass blocks) : " as *u8, uxg_skiplink_ok(page, pn)) 40 uxr_emit(" lang attribute : " as *u8, uxg_lang_ok(page, pn)) 41 uxr_emit(" title : " as *u8, uxg_title_ok(page, pn)) 42 uxr_emit(" nav landmark : " as *u8, uxg_nav_ok(page, pn)) 43 uxr_emit(" sovereign (no external src=) : " as *u8, uxg_sovereign_ok(page, pn)) 44 uxr_emit(" back-nav (not browser-only) : " as *u8, uxg_back_ok(js, jn)) 45 uxr_emit(" loading state : " as *u8, uxg_loading_ok(js, jn)) 46 uxr_emit(" error state : " as *u8, uxg_error_ok(js, jn)) 47 uxr_emit(" empty state : " as *u8, uxg_empty_ok(js, jn)) 48 uxr_puts(" PERMIL = " as *u8) 49 print_i64(uxg_grade_full(page, pn, js, jn)) 50 uxr_puts(" / 1000\n\n" as *u8) 51 return 0 52} 53 54func main() -> i64 { 55 uxr_puts("=== nx_uxcx_grade :: sovereign grade of the live library (both checkouts) ===\n\n" as *u8) 56 uxr_grade_tree("FIXED tree (WSL-home ~/nishi-library; this session's fixes):" as *u8, "/home/elderwesto/nishi-library/nishilib/web/index.html" as *u8, "/home/elderwesto/nishi-library/nishilib/web/app.js" as *u8) 57 uxr_grade_tree("CANONICAL tree (C:/nishi-library; operator's program-on-C:, NOT yet fixed):" as *u8, "/mnt/c/Users/elder/nishi-library/nishilib/web/index.html" as *u8, "/mnt/c/Users/elder/nishi-library/nishilib/web/app.js" as *u8) 58 return 0 59}