code wiki / _hdl_build / nx_video_exceed_census_gate.nx

nx_video_exceed_census_gate.nx source

↩ module page · 75 lines · 6502 B

1// nx_video_exceed_census_gate.nx -- the MEASURED video-capability census (replaces the GRADE-D hand-wave with 2// a number). Anti-liar BY CONSTRUCTION: each sub-capability is EXISTS only if its organ FILE actually opens on 3// disk; the honest long-poles (ASR, open-domain NMT, SFU multi-party, AV1) are ABSENT entries -- NOT faked, so 4// the coverage number is real. Pos-control: the new caption-burn organ EXISTS. Neg-control: a bogus organ path 5// is ABSENT (the census never fabricates). coverage_permil = exists*1000/total. expect_exit: 0 license_tier: ORIGINAL 6import "nx_syscalls.nx" 7 8func vc(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 9func vcn(v: i64) -> i64 { 10 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 } 11 var m: i64 = v; if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 12 let d: *u8 = sys_mmap(24); var k: i64 = 0 13 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 14 var j: i64 = k - 1 15 while j >= 0 { sys_write(1, ((d as i64)+j) as *u8, 1); j = j - 1 } 16 return 0 17} 18func have(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } 19 20func main() -> i64 { 21 vc("=== nx_video_exceed_census_gate: MEASURED video coverage (organ-on-disk, anti-liar) ===\n" as *u8) 22 let N: i64 = 24 23 let names: **u8 = sys_mmap(N * 8) as **u8 24 let paths: **u8 = sys_mmap(N * 8) as **u8 25 let surf: **u8 = sys_mmap(N * 8) as **u8 26 var t: i64 = 0 27 names[t]="codec-iframe" as *u8; paths[t]="runtime/nx_video_codec.nx" as *u8; surf[t]="codec " as *u8; t=t+1 28 names[t]="codec-inter" as *u8; paths[t]="runtime/nx_vcodec.nx" as *u8; surf[t]="codec " as *u8; t=t+1 29 names[t]="container-mp4" as *u8; paths[t]="runtime/nx_mp4_demux.nx" as *u8; surf[t]="codec " as *u8; t=t+1 30 names[t]="media-server" as *u8; paths[t]="runtime/_hdl_build/nx_media_server.nx" as *u8; surf[t]="sites " as *u8; t=t+1 31 names[t]="sitegen-video" as *u8; paths[t]="runtime/_hdl_build/nx_sitegen_video.nx" as *u8; surf[t]="sites " as *u8; t=t+1 32 names[t]="live-embed" as *u8; paths[t]="runtime/_hdl_build/nx_video_embed.nx" as *u8; surf[t]="live " as *u8; t=t+1 33 names[t]="webrtc-signaling" as *u8; paths[t]="runtime/nx_friend_video_caller.nx" as *u8; surf[t]="live " as *u8; t=t+1 34 names[t]="caption-burn" as *u8; paths[t]="runtime/_hdl_build/nx_caption_burn.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 35 names[t]="mt-phrasetable" as *u8; paths[t]="runtime/_hdl_build/nx_mt_phrasetable.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 36 names[t]="topic-suggest" as *u8; paths[t]="runtime/_hdl_build/nx_topic_suggest.nx" as *u8; surf[t]="topic " as *u8; t=t+1 37 names[t]="game-touch-mobile" as *u8; paths[t]="runtime/_hdl_build/nx_game_touch.nx" as *u8; surf[t]="mobile " as *u8; t=t+1 38 names[t]="research-corpus" as *u8; paths[t]="knowledge/fetched/vidfeat_webrtc.raw" as *u8; surf[t]="research" as *u8; t=t+1 39 names[t]="bidi-ru-en-mt" as *u8; paths[t]="runtime/_hdl_build/nx_mt_ruen.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 40 names[t]="cyrillic-font" as *u8; paths[t]="runtime/_hdl_build/nx_font_cyrillic8.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 41 names[t]="unicode-caption" as *u8; paths[t]="runtime/_hdl_build/nx_caption_render_uni.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 42 names[t]="xlate-call-router" as *u8; paths[t]="runtime/_hdl_build/nx_live_xlate_call.nx" as *u8; surf[t]="live " as *u8; t=t+1 43 names[t]="multilang-mt" as *u8; paths[t]="runtime/_hdl_build/nx_mt_multi.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 44 names[t]="latin-ext-font" as *u8; paths[t]="runtime/_hdl_build/nx_font_latinext8.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 45 names[t]="cyrillic-ext-font" as *u8; paths[t]="runtime/_hdl_build/nx_font_cyrillic_ext8.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 46 names[t]="asr-frontend" as *u8; paths[t]="runtime/_hdl_build/nx_asr_frontend.nx" as *u8; surf[t]="asr " as *u8; t=t+1 47 // honest long-poles -- ABSENT (routed to the RESEARCHER), never faked: 48 names[t]="asr-speech2text" as *u8; paths[t]="runtime/nx_asr_decode.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 49 names[t]="nmt-open-domain" as *u8; paths[t]="runtime/nx_nmt_translate.nx" as *u8; surf[t]="xlate " as *u8; t=t+1 50 names[t]="sfu-multiparty" as *u8; paths[t]="runtime/nx_sfu.nx" as *u8; surf[t]="live " as *u8; t=t+1 51 names[t]="av1-vp9-decode" as *u8; paths[t]="runtime/nx_av1_decode.nx" as *u8; surf[t]="codec " as *u8; t=t+1 52 53 var exists: i64 = 0 54 var i: i64 = 0 55 while i < N { 56 let h: i64 = have(paths[i]) 57 vc(" [" as *u8); vc(surf[i]); vc("] " as *u8); vc(names[i]); vc(" -> " as *u8) 58 if h == 1 { exists = exists + 1; vc("EXISTS\n" as *u8) } else { vc("ABSENT (long-pole)\n" as *u8) } 59 i = i + 1 60 } 61 let permil: i64 = (exists * 1000) / N 62 vc(" MEASURED coverage = " as *u8); vcn(exists); vc("/" as *u8); vcn(N); vc(" = " as *u8); vcn(permil); vc(" permil\n" as *u8) 63 64 var pass: i64 = 0 65 var fail: i64 = 0 66 if have("runtime/_hdl_build/nx_caption_burn.nx" as *u8) == 1 { pass=pass+1; vc(" POS-control caption-burn EXISTS: GREEN\n" as *u8) } else { fail=fail+1; vc(" POS-control: RED\n" as *u8) } 67 if have("runtime/_hdl_build/nx_does_not_exist_xyz.nx" as *u8) == 0 { pass=pass+1; vc(" NEG-control bogus ABSENT: GREEN\n" as *u8) } else { fail=fail+1; vc(" NEG-control: RED (fabricated)\n" as *u8) } 68 if exists >= 10 { pass=pass+1 } else { fail=fail+1; vc(" FAIL too-few-exists\n" as *u8) } 69 vc(" NOTE: this measures ORGAN-ON-DISK COVERAGE, not liveness -- a DEAD room can still score GREEN here.\n" as *u8) 70 vc(" For actual /video enterability run nx_funcheck (the video_room flow), not this census.\n" as *u8) 71 72 vc("VIDEO-EXCEED-CENSUS exists=" as *u8); vcn(exists); vc(" total=" as *u8); vcn(N); vc(" permil=" as *u8); vcn(permil); vc(" pass=" as *u8); vcn(pass); vc(" fail=" as *u8); vcn(fail) 73 if fail == 0 { vc(" verdict=GREEN -- measured organ-on-disk coverage; long-poles honestly ABSENT; controls hold\n" as *u8); sys_exit(0); return 0 } 74 vc(" verdict=RED\n" as *u8); sys_exit(1); return 1 75}