code wiki / _hdl_build / nx_mobile_census.nx
nx_mobile_census.nx source
↩ module page · 85 lines · 5078 B
1// nx_mobile_census.nx -- MOBILE/CLIENTS readiness census (R0): fills the stack audit's R11 honest
2// hole ("clients-mobile: UNKNOWN(no-source)") with a MEASURED instrument. Every cell = open a REAL
3// file in web_assets/ and check a mechanical marker -- no self-report, no assumed wiring. Grounded
4// by probe 2026-07-02: manifest.webmanifest EXISTS (735B, /video/ standalone) + sw.js EXISTS (cache
5// logic) + nx_zoom_reader.html has touch input + 2 pages link the manifest -- but ZERO pages register
6// the service worker (BUILT-not-LIVE, the exact failure class the MONITOR group exists to catch).
7// CONTROLS in-line (census idiom, cf kernel/cms census): control_pos = a marker guaranteed present
8// must read PRESENT; control_neg = a planted nonsense marker must read ABSENT; either misread =>
9// verdict=RED (liar-kill). Durable line -> knowledge/status/mobile_census.log with
10// our_coverage_permil= (the stack audit's R11 evidence pattern). license_tier: ORIGINAL
11import "nx_ecomat_lib.nx"
12
13const MOB_LOG: *u8 = "knowledge/status/mobile_census.log"
14
15// does file at path contain marker? 0/1 (missing/empty file => 0, never a fabricated present)
16func mob_has(path: *u8, marker: *u8) -> i64 {
17 let szp: *i64 = sys_mmap(16) as *i64
18 let b: *u8 = ss_readall(path, szp)
19 var n: i64 = szp[0]
20 if n <= 0 { return 0 }
21 return el_contains(b, n, marker)
22}
23
24func mob_cell(idx: i64, name: *u8, path: *u8, marker: *u8) -> i64 {
25 let hit: i64 = mob_has(path, marker)
26 _p("MOBCELL cell=" as *u8); _p(name)
27 _p(" file=" as *u8); _p(path)
28 _p(" status=" as *u8)
29 if hit == 1 { _p("PRESENT\n" as *u8) } else { _p("ABSENT\n" as *u8) }
30 return hit
31}
32
33func main(argc: i64, argv: *i64) -> i64 {
34 _p("=== NISHI MOBILE/CLIENTS CENSUS -- R11 evidence, cells opened from real web_assets files ===\n" as *u8)
35 var present: i64 = 0
36 var total: i64 = 0
37
38 present = present + mob_cell(1, "viewport-hub" as *u8, "web_assets/hub.html" as *u8, "viewport" as *u8); total = total + 1
39 present = present + mob_cell(2, "viewport-video" as *u8, "web_assets/video.html" as *u8, "viewport" as *u8); total = total + 1
40 present = present + mob_cell(3, "viewport-games" as *u8, "web_assets/games.html" as *u8, "viewport" as *u8); total = total + 1
41 present = present + mob_cell(4, "viewport-reader-zoom" as *u8, "web_assets/nx_zoom_reader.html" as *u8, "viewport" as *u8); total = total + 1
42 present = present + mob_cell(5, "touch-reader-zoom" as *u8, "web_assets/nx_zoom_reader.html" as *u8, "touch" as *u8); total = total + 1
43 present = present + mob_cell(6, "responsive-media-video" as *u8, "web_assets/video.html" as *u8, "@media" as *u8); total = total + 1
44 present = present + mob_cell(7, "pwa-manifest-file" as *u8, "web_assets/manifest.webmanifest" as *u8, "start_url" as *u8); total = total + 1
45 present = present + mob_cell(8, "manifest-linked" as *u8, "web_assets/video.html" as *u8, "webmanifest" as *u8); total = total + 1
46 present = present + mob_cell(9, "manifest-icons" as *u8, "web_assets/manifest.webmanifest" as *u8, "icons" as *u8); total = total + 1
47 present = present + mob_cell(10, "sw-offline-file" as *u8, "web_assets/sw.js" as *u8, "cache" as *u8); total = total + 1
48 present = present + mob_cell(11, "sw-registered" as *u8, "web_assets/video.html" as *u8, "serviceWorker" as *u8); total = total + 1
49 present = present + mob_cell(12, "native-app-artifact" as *u8, "web_assets/nishi.apk" as *u8, "PK" as *u8); total = total + 1
50
51 // in-line controls (liar-kill): a guaranteed-present marker + a planted-nonsense marker
52 let cpos: i64 = mob_has("web_assets/hub.html" as *u8, "html" as *u8)
53 let cneg: i64 = mob_has("web_assets/hub.html" as *u8, "ZZMOBILE-NEVER-MARKER-ZZ" as *u8)
54 var verdict_red: i64 = 0
55 if cpos != 1 { verdict_red = 1 }
56 if cneg != 0 { verdict_red = 1 }
57
58 var permil: i64 = 0
59 if total > 0 { permil = (1000 * present) / total }
60
61 let lfd: i64 = sys_openat_append(MOB_LOG, 0x1a4)
62 if lfd >= 0 {
63 _fp(lfd, "MOBILECENSUS epoch=" as *u8); _fn(lfd, sys_now_realtime_sec())
64 _fp(lfd, " cells=" as *u8); _fn(lfd, total)
65 _fp(lfd, " present=" as *u8); _fn(lfd, present)
66 _fp(lfd, " absent=" as *u8); _fn(lfd, total - present)
67 _fp(lfd, " our_coverage_permil=" as *u8); _fn(lfd, permil)
68 _fp(lfd, " control_pos=" as *u8); _fn(lfd, cpos)
69 _fp(lfd, " control_neg=" as *u8); _fn(lfd, cneg)
70 _fp(lfd, " src=web_assets verdict=" as *u8)
71 if verdict_red == 0 { _fp(lfd, "MEASURED" as *u8) } else { _fp(lfd, "RED" as *u8) }
72 _fp(lfd, "\n" as *u8)
73 sys_close(lfd)
74 }
75
76 _p("\n SUMMARY cells=" as *u8); _fn(1, total)
77 _p(" present=" as *u8); _fn(1, present)
78 _p(" our_coverage_permil=" as *u8); _fn(1, permil)
79 _p(" control_pos=" as *u8); _fn(1, cpos)
80 _p(" control_neg=" as *u8); _fn(1, cneg)
81 _p(" verdict=" as *u8)
82 if verdict_red == 0 { _p("MEASURED\n" as *u8) } else { _p("RED (control misread -- liar-kill)\n" as *u8) }
83 sys_exit(verdict_red)
84 return verdict_red
85}