code wiki / (root) / nx_healthhelp_site_gate.nx

nx_healthhelp_site_gate.nx source

↩ module page · 64 lines · 3696 B

1// nx_healthhelp_site_gate.nx -- M6 GATE: the portal page is complete (size + structure), carries every 2// engine's load-bearing content (dispute grounds, 180-day appeal window, 501(r) + collection hold, PPDR, 3// written-answer accountability), keeps placeholders intact, and is SAFE BY CONSTRUCTION for the no-PHI 4// phase: zero <script>, zero external src=, collects nothing. Exits 0 iff ALL pass. license_tier: ORIGINAL 5import "nx_syscalls.nx" 6import "nx_medbill_codes.nx" 7import "nx_healthhelp_site.nx" 8 9func g_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 10func g_putn(v: i64) -> i64 { 11 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 } 12 var m: i64 = v 13 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 14 let d: *u8 = sys_mmap(24) 15 var k: i64 = 0 16 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 17 let r: *u8 = sys_mmap(24) 18 var i: i64 = 0 19 while k > 0 { k = k - 1; r[i] = d[k]; i = i + 1 } 20 sys_write(1, r, i) 21 return 0 22} 23func chk(name: *u8, got: i64, want: i64, st: *i64) -> i64 { 24 if got == want { st[0] = st[0] + 1; g_puts(" PASS " as *u8); g_puts(name); g_puts("\n" as *u8) } 25 else { st[1] = st[1] + 1; g_puts(" FAIL " as *u8); g_puts(name); g_puts(" got=" as *u8); g_putn(got); g_puts(" want=" as *u8); g_putn(want); g_puts("\n" as *u8) } 26 return 0 27} 28 29func main() -> i64 { 30 let st: *i64 = sys_mmap(16) as *i64 31 st[0] = 0 32 st[1] = 0 33 let page: *u8 = sys_mmap(65536) 34 let n: i64 = hh_page(page) 35 var big: i64 = 0 36 if n > 8000 { big = 1 } 37 chk("page is a real page (>8KB)" as *u8, big, 1, st) 38 chk("html structure present" as *u8, mbc_contains(page, "<html\x00" as *u8), 1, st) 39 chk("closes cleanly" as *u8, mbc_contains(page, "</html>\x00" as *u8), 1, st) 40 chk("dispute engine content (good-faith dispute)" as *u8, mbc_contains(page, "good-faith dispute\x00" as *u8), 1, st) 41 chk("appeal engine content (180 days)" as *u8, mbc_contains(page, "180 days\x00" as *u8), 1, st) 42 chk("charity engine content (501(r))" as *u8, mbc_contains(page, "501(r)\x00" as *u8), 1, st) 43 chk("charity collection hold present" as *u8, mbc_contains(page, "extraordinary collection\x00" as *u8), 1, st) 44 chk("PPDR engine content present" as *u8, mbc_contains(page, "Patient-Provider Dispute Resolution\x00" as *u8), 1, st) 45 chk("civic engine demands a written response" as *u8, mbc_contains(page, "written response\x00" as *u8), 1, st) 46 chk("accountability verdicts explained" as *u8, mbc_contains(page, "OVERDUE-UNRESPONSIVE\x00" as *u8), 1, st) 47 chk("placeholders intact" as *u8, mbc_contains(page, "[PATIENT NAME]\x00" as *u8), 1, st) 48 chk("no-PHI stance stated (collects nothing)" as *u8, mbc_contains(page, "collects nothing\x00" as *u8), 1, st) 49 chk("decision-support framing present" as *u8, mbc_contains(page, "Decision-support\x00" as *u8), 1, st) 50 chk("SAFE: zero script tags" as *u8, mbc_contains(page, "<script\x00" as *u8), 0, st) 51 chk("SAFE: zero external src=" as *u8, mbc_contains(page, "src=\x00" as *u8), 0, st) 52 chk("TONE: partnership framing present" as *u8, mbc_contains(page, "working with your provider\x00" as *u8), 1, st) 53 chk("TONE: never says fight" as *u8, mbc_contains(page, "fight\x00" as *u8), 0, st) 54 chk("TONE: never says arsenal" as *u8, mbc_contains(page, "arsenal\x00" as *u8), 0, st) 55 56 g_puts("nx_healthhelp_site_gate: PASS=" as *u8) 57 g_putn(st[0]) 58 g_puts(" FAIL=" as *u8) 59 g_putn(st[1]) 60 g_puts("\n" as *u8) 61 if st[1] == 0 { g_puts("M6 nx_healthhelp_site: GREEN\n" as *u8); return 0 } 62 g_puts("M6 nx_healthhelp_site: RED\n" as *u8) 63 return 1 64}