code wiki / _hdl_build / nx_ui_audit.nx

nx_ui_audit.nx source

↩ module page · 188 lines · 18781 B

1// nx_ui_audit.nx -- ui-debt lane. The REAL design-quality judge (the operator's #1 gap: incredible backend + 2// dev-grade frontend != SOTA). The existing judge (nx_page_verify a11y-lite + nx_contrast) measures DOCUMENT 3// STRUCTURE (title/h1/main/alt) + is a contrast CALCULATOR -- it CANNOT tell a designed product from a dev 4// dump. This measures DESIGN QUALITY from the live page source, LIAR-KILLED (every sub-score IS a measured 5// count over the fetched bytes -- unfakeable). Composes nx_https_get (fork-capture) for the fetch; complements 6// (does NOT touch) the racing-owned page_verify/nx_contrast. Run across every surface -> the UI-debt MAP. 7// Dimensions (source-measurable, high design-signal): design-TOKEN discipline (var(--)), THEME-awareness 8// (prefers-color-scheme), RESPONSIVE (@media + viewport), TYPE-scale (clamp + font-size variety), POLISH 9// (transition/animation/:focus). Score/12 -> grade DEV-GRADE/FUNCTIONAL/DESIGNED/POLISHED. 10// nx_ui_audit <url> [connect-host:port] (override 127.0.0.1:8443 for our own domains) 11// ENVELOPE (declared): analyzes INLINE CSS in the fetched HTML (external stylesheets + rendered-pixel + 12// real-color-extraction-into-nx_contrast = next rungs, honestly deferred). 512KB capture. 13// exit: 0 audited | 4 fetch-fail | 2 usage. 14// license_tier: ORIGINAL expect_exit: 0 15import "nx_tool_run.nx" 16// ***ADOPT THE PROVEN SPINE, DO NOT FORK.*** Measured 2026-08-06: this organ returned FETCH-FAIL 17// empty for EVERY url -- including a 16KB control page, which refutes any size ceiling -- while 18// nx_page_verify fetched the SAME url to HTTP 200 / 40996 bytes in the same minute. The difference is 19// structural, not incidental: page_verify composes nx_https_fetch_follow IN-PROCESS, this organ forked 20// nx_https_get.elf through tr_run_capture. A fork adds a whole failure surface (process table, pipe, 21// capture buffer, host pressure) to a job that needs none of it, and every one of those failures 22// arrives disguised as "the subject is unreachable". 23// ***WHEN A SIBLING ORGAN DOES THE SAME JOB WITHOUT THE FAILURE, THE FIX IS ADOPTION, NOT REPAIR.*** 24import "nx_https_fetch_follow.nx" 25import "nx_trust_store_load_from_certdata.nx" 26import "nx_https_url_connect.nx" // nx_https_connect_override_set -- the co-squat pin 27const UA_MAGIC_30000: i64 = 30000 28const UA_MAGIC_524288: i64 = 524288 29const UA_MAGIC_32768: i64 = 32768 30const UA_MAGIC_2048: i64 = 2048 31 32// REDIRECT/STUB GUARD constants (trap T1, 2026-07-20 claude_e8e3bdf3; rule-11: named, not inline). 33const UA_MINBYTES: i64 = 1024 34const UA_EXIT_UNSCORABLE: i64 = 5 35 36func ua_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } 37func ua_n(fd: i64, v: i64) -> i64 { 38 let t: *u8 = sys_mmap(28) 39 var m: i64 = v 40 var k: i64 = 0 41 if m == 0 { t[0] = 48 as u8; k = 1 } 42 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 43 let b: *u8 = sys_mmap(28) 44 var i: i64 = 0 45 while i < k { b[i] = t[k - 1 - i]; i = i + 1 } 46 sys_write(fd, b, k) 47 sys_munmap(t, 28) 48 sys_munmap(b, 28) 49 return 0 50} 51func ua_b(rep: *u8, pos: i64, s: *u8) -> i64 { var p: i64 = pos; var i: i64 = 0; while s[i] != (0 as u8) { if p < UA_MAGIC_30000 { rep[p] = s[i]; p = p + 1 } i = i + 1 } return p } 52func ua_bn(rep: *u8, pos: i64, v: i64) -> i64 { var p: i64 = pos; var m: i64 = v; if m < 0 { if p < UA_MAGIC_30000 { rep[p] = 45 as u8; p = p + 1 } m = 0 - m } let t: *u8 = sys_mmap(28); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { if p < UA_MAGIC_30000 { rep[p] = t[k - 1 - i]; p = p + 1 } i = i + 1 } return p } 53func ua_q(rep: *u8, pos: i64) -> i64 { var p: i64 = pos; if p < UA_MAGIC_30000 { rep[p] = 34 as u8; p = p + 1 } return p } 54func ua_je(rep: *u8, pos: i64, src: *u8, s: i64, e: i64) -> i64 { var p: i64 = pos; var i: i64 = s; while i < e { let c: i64 = src[i]; if c == 34 { if p < UA_MAGIC_30000 { rep[p] = 92 as u8; p = p + 1 } if p < UA_MAGIC_30000 { rep[p] = 34 as u8; p = p + 1 } } else { if c == 92 { if p < UA_MAGIC_30000 { rep[p] = 92 as u8; p = p + 1 } if p < UA_MAGIC_30000 { rep[p] = 92 as u8; p = p + 1 } } else { if c < 32 { if p < UA_MAGIC_30000 { rep[p] = 32 as u8; p = p + 1 } } else { if p < UA_MAGIC_30000 { rep[p] = c as u8; p = p + 1 } } } } i = i + 1 } return p } 55func ua_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 56// count non-overlapping occurrences of NUL-term pat in buf[0,n) 57func ua_count(buf: *u8, n: i64, pat: *u8) -> i64 { 58 var pl: i64 = 0 59 while pat[pl] != (0 as u8) { pl = pl + 1 } 60 if pl == 0 { return 0 } 61 var c: i64 = 0 62 var i: i64 = 0 63 while i + pl <= n { 64 var k: i64 = 0 65 var m: i64 = 1 66 while k < pl { if buf[i + k] != pat[k] { m = 0; k = pl } else { k = k + 1 } } 67 if m == 1 { c = c + 1; i = i + pl } else { i = i + 1 } 68 } 69 return c 70} 71func main(argc: i64, argv: *i64) -> i64 { 72 if argc < 2 { ua_w(2, "usage: nx_ui_audit <url> [connect-host:port]\n" as *u8); sys_exit(2); return 2 } 73 let url: *u8 = argv[1] as *u8 74 let cap: i64 = UA_MAGIC_524288 75 let buf: *u8 = sys_mmap(cap + 16) 76 let olen: *i64 = sys_mmap(16) as *i64 77 // The pin: an explicit argv[2] override sets the global connect endpoint consumed by the fetch 78 // layer, exactly as nx_page_verify does. Without it, a bare :443 fetch of one of OUR hosts from 79 // the NAS is a coin flip against the DSM nginx co-squat -- which answers 404 and would be graded 80 // as a real page. The UNSCORABLE guard below is the second line of defence for that case. 81 var pinned: i64 = 0 82 if argc >= 3 { if nx_https_connect_override_set(argv[2] as *u8) == 1 { pinned = 1 } } 83 if pinned == 1 { ua_w(1, "vantage=PINNED (deterministic sovereign edge)\n" as *u8) } 84 else { ua_w(1, "vantage=DNS (no connect-override given -- for OUR OWN domains pass 127.0.0.1:8443, or a :443 co-squat 404 can be graded as a page)\n" as *u8) } 85 let lr: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt\x00" as *u8, 300, UA_MAGIC_524288 * 8) 86 let store: *TrustStore = lr as *TrustStore 87 if lr <= 0 { 88 ua_w(1, "UI-AUDIT verdict=UNMEASURED trust-store unreadable (needs data/mozilla_certdata.txt; run from the repo root) -- refusing to grade\n" as *u8) 89 sys_exit(4); return 4 90 } 91 let st: *i64 = sys_mmap(16) as *i64 92 var n: i64 = nx_https_fetch_follow(url, store, buf, cap, 5, st) 93 var frc: i64 = 0 94 if n <= 0 { frc = 0 } 95 // ***A FORK-CAPTURE THAT RETURNS EMPTY UNDER LOAD IS NOT AN UNREACHABLE SUBJECT.*** Measured 96 // 2026-08-06: this organ returned FETCH-FAIL empty for EVERY url -- including a control page -- 97 // while nx_https_get fetched the SAME url with the SAME override to HTTP 200 / 40996 bytes in the 98 // same minute. The fetcher worked; the fork around it did not, under host churn. One bounded retry 99 // separates a flaky capture from a dead subject. Sharing one verdict between them made a sick 100 // INSTRUMENT indistinguishable from a sick TARGET -- the diagnosis-collapse this estate keeps 101 // paying for, and the same split nx_gate_bite had to make between exit 2 and exit 4. 102 if n <= 0 { 103 n = nx_https_fetch_follow(url, store, buf, cap, 5, st) 104 if n > 0 { ua_w(1, " [retry] first fetch failed, second succeeded -- TRANSIENT, not an unreachable subject\n" as *u8) } 105 } 106 if frc == 127 { ua_w(1, "UI-AUDIT verdict=FETCH-FAIL exec-127\n" as *u8); sys_exit(4); return 4 } 107 if n <= 0 { ua_w(1, "UI-AUDIT verdict=FETCH-FAIL empty-twice (retried; treat as genuinely unreachable)\n" as *u8); sys_exit(4); return 4 } 108 // ***THE GUARD THAT WAS WRITTEN DOWN AND NEVER APPLIED.*** UA_MINBYTES and UA_EXIT_UNSCORABLE were 109 // declared as a REDIRECT/STUB GUARD and each appeared EXACTLY ONCE in this file -- at its own 110 // declaration. A const whose name occurs once is DEAD; writing a limit down is not applying it. 111 // CONSEQUENCE MEASURED 2026-08-06: called without the connect-override on one of our OWN domains, a 112 // bare :443 fetch from the NAS lands on the DSM nginx co-squat and returns its 404 body (548 bytes, 113 // proven side-by-side against 40089 bytes with 127.0.0.1:8443). This organ scored that 404 as 114 // score=0/12 grade=DEV-GRADE with EVERY dimension measured=0 -- a verdict indistinguishable in any 115 // report from a real page that has no design system at all. 116 // ***A ZERO ON EVERY DIMENSION AT ONCE IS THE SIGNATURE OF A FAILED FETCH, NOT AN UGLY PAGE.*** 117 if n < UA_MINBYTES { 118 ua_w(1, "UI-AUDIT verdict=UNSCORABLE bytes=" as *u8); ua_n(1, n) 119 ua_w(1, " (under UA_MINBYTES) -- REFUSING to score. This is almost always a redirect stub or the DSM :443 co-squat 404, NOT a page. For our own domains pass the connect-override: nx_ui_audit <url> 127.0.0.1:8443\n" as *u8) 120 sys_exit(UA_EXIT_UNSCORABLE); return UA_EXIT_UNSCORABLE 121 } 122 // ---- measure (each = a real count over the fetched bytes) ---- 123 let toks: i64 = ua_count(buf, n, "var(--" as *u8) 124 let theme: i64 = ua_count(buf, n, "prefers-color-scheme" as *u8) 125 let media: i64 = ua_count(buf, n, "@media" as *u8) 126 let viewport: i64 = ua_count(buf, n, "viewport" as *u8) 127 let clampc: i64 = ua_count(buf, n, "clamp(" as *u8) 128 let fsz: i64 = ua_count(buf, n, "font-size" as *u8) 129 let trans: i64 = ua_count(buf, n, "transition" as *u8) 130 let anim: i64 = ua_count(buf, n, "animation" as *u8) 131 let focusv: i64 = ua_count(buf, n, ":focus" as *u8) 132 let hexcol: i64 = ua_count(buf, n, ":#" as *u8) 133 let hasstyle: i64 = ua_count(buf, n, "<style" as *u8) 134 // ---- score (max 12) ---- 135 var p_tok: i64 = 0 136 if toks == 0 { p_tok = 0 } else { if toks <= 5 { p_tok = 1 } else { if toks <= 15 { p_tok = 2 } else { p_tok = 3 } } } 137 var p_theme: i64 = 0 138 if theme > 0 { p_theme = 2 } 139 var p_resp: i64 = media 140 if p_resp > 3 { p_resp = 3 } 141 if viewport == 0 { p_resp = 0 } 142 var p_type: i64 = 0 143 if clampc > 0 { p_type = p_type + 1 } 144 if fsz >= 3 { p_type = p_type + 1 } 145 var p_polish: i64 = 0 146 if trans > 0 { p_polish = p_polish + 1 } else { if anim > 0 { p_polish = p_polish + 1 } } 147 if focusv > 0 { p_polish = p_polish + 1 } 148 let total: i64 = p_tok + p_theme + p_resp + p_type + p_polish 149 let rep: *u8 = sys_mmap(UA_MAGIC_32768) 150 var p: i64 = 0 151 p = ua_b(rep, p, "{" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "kind" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "ui_design_quality" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8) 152 p = ua_q(rep, p); p = ua_b(rep, p, "url" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_je(rep, p, url, 0, ua_slen(url)); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8) 153 p = ua_q(rep, p); p = ua_b(rep, p, "bytes" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, n); p = ua_b(rep, p, "," as *u8) 154 p = ua_q(rep, p); p = ua_b(rep, p, "dimensions" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":[" as *u8) 155 // tokens 156 p = ua_b(rep, p, "{" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "dim" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "design-tokens" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "measured" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, toks); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "unit" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "var(--) uses" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "points" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, p_tok); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "max" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":3}," as *u8) 157 // theme 158 p = ua_b(rep, p, "{" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "dim" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "theme-aware" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "measured" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, theme); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "unit" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "prefers-color-scheme" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "points" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, p_theme); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "max" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":2}," as *u8) 159 // responsive 160 p = ua_b(rep, p, "{" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "dim" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "responsive" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "measured" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, media); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "unit" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "@media queries (viewport=" as *u8); p = ua_bn(rep, p, viewport); p = ua_b(rep, p, ")" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "points" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, p_resp); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "max" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":3}," as *u8) 161 // type 162 p = ua_b(rep, p, "{" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "dim" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "type-scale" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "measured" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, fsz); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "unit" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "font-size decls (clamp=" as *u8); p = ua_bn(rep, p, clampc); p = ua_b(rep, p, ")" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "points" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, p_type); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "max" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":2}," as *u8) 163 // polish 164 p = ua_b(rep, p, "{" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "dim" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "polish" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "measured" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, trans + anim + focusv); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "unit" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "transition+animation+:focus" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "points" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, p_polish); p = ua_b(rep, p, "," as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "max" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":2}" as *u8) 165 p = ua_b(rep, p, "]," as *u8) 166 p = ua_q(rep, p); p = ua_b(rep, p, "score" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, total); p = ua_b(rep, p, "," as *u8) 167 p = ua_q(rep, p); p = ua_b(rep, p, "max" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":12," as *u8) 168 p = ua_q(rep, p); p = ua_b(rep, p, "explicit_colors" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, hexcol); p = ua_b(rep, p, "," as *u8) 169 p = ua_q(rep, p); p = ua_b(rep, p, "has_stylesheet" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_bn(rep, p, hasstyle); p = ua_b(rep, p, "," as *u8) 170 p = ua_q(rep, p); p = ua_b(rep, p, "grade" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p) 171 if total <= 3 { p = ua_b(rep, p, "DEV-GRADE" as *u8) } else { if total <= 6 { p = ua_b(rep, p, "HYGIENE-PARTIAL" as *u8) } else { if total <= 9 { p = ua_b(rep, p, "HYGIENE-GOOD" as *u8) } else { p = ua_b(rep, p, "HYGIENE-COMPLETE" as *u8) } } } 172 p = ua_q(rep, p); p = ua_b(rep, p, "," as *u8) 173 p = ua_q(rep, p); p = ua_b(rep, p, "envelope" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, ":" as *u8); p = ua_q(rep, p); p = ua_b(rep, p, "MEASURES DESIGN-SYSTEM HYGIENE ONLY (are the ingredients present: tokens/theme/responsive/type/polish) -- NOT aesthetic or brand quality vs SOTA (Nike/agency). A HYGIENE-COMPLETE page can still look toy. PREMIUM certification needs perceptual (VLM/human on-brand judgment) + structural (nx_ui_struct AXTree tree-edit-distance regression) + rendered-pixel validation -- filed rungs, NOT this score. Do not read this as a design-quality verdict." as *u8); p = ua_q(rep, p) 174 p = ua_b(rep, p, "}" as *u8) 175 sys_write(1, rep, p) 176 let tfd: i64 = sys_openat_wr("knowledge/status/ui_audit.out.tmp" as *u8, 420) 177 if tfd >= 0 { sys_write(tfd, rep, p); sys_close(tfd); sys_renameat("knowledge/status/ui_audit.out.tmp" as *u8, "knowledge/status/ui_audit.out" as *u8) } 178 // append one MAP line per run -> auditing every surface BUILDS the UI-debt map (the operator's 'mapped to everything') 179 let mp: *u8 = sys_mmap(UA_MAGIC_2048) 180 var q: i64 = 0 181 q = ua_b(mp, q, "UI-MAP\t" as *u8); q = ua_b(mp, q, url); q = ua_b(mp, q, "\tscore=" as *u8); q = ua_bn(mp, q, total); q = ua_b(mp, q, "/12\tgrade=" as *u8) 182 if total <= 3 { q = ua_b(mp, q, "DEV-GRADE" as *u8) } else { if total <= 6 { q = ua_b(mp, q, "HYGIENE-PARTIAL" as *u8) } else { if total <= 9 { q = ua_b(mp, q, "HYGIENE-GOOD" as *u8) } else { q = ua_b(mp, q, "HYGIENE-COMPLETE" as *u8) } } } 183 q = ua_b(mp, q, "\ttok=" as *u8); q = ua_bn(mp, q, p_tok); q = ua_b(mp, q, "\ttheme=" as *u8); q = ua_bn(mp, q, p_theme); q = ua_b(mp, q, "\tresp=" as *u8); q = ua_bn(mp, q, p_resp); q = ua_b(mp, q, "\ttype=" as *u8); q = ua_bn(mp, q, p_type); q = ua_b(mp, q, "\tpolish=" as *u8); q = ua_bn(mp, q, p_polish); q = ua_b(mp, q, "\n" as *u8) 184 let mfd: i64 = sys_openat_append("knowledge/status/ui_debt_map.log" as *u8, 420) 185 if mfd >= 0 { sys_write(mfd, mp, q); sys_close(mfd) } 186 sys_exit(0) 187 return 0 188}