code wiki / _hdl_build / nx_compare_growth_final_gate_20260910.nx

nx_compare_growth_final_gate_20260910.nx source

↩ module page · 89 lines · 5980 B

1// nx_compare_growth_final_gate_20260910.nx -- Generates JSON and HTML reports comparing growth models across specified domains. 2import "nx_swcompare_growth_candidate_20260910.nx" 3import "nx_gatekit_lib.nx" 4import "nx_gate_verdict.nx" 5func cgi_path(prefix: *u8,suffix: *u8) -> *u8 { 6 let out: *u8=sys_mmap(SGP_PATH_CAP) 7 let a: i64=sg_len(prefix); let b: i64=sg_len(suffix) 8 if a+b+1>SGP_PATH_CAP { return 0 as *u8 } 9 var p: i64=scopy(out,0,prefix); p=scopy(out,p,suffix); out[p]=0 as u8; return out 10} 11func cgi_domain(domain: *u8,fd: i64,ctr: *i64) -> i64 { 12 let m: *SgPlan=sg_load(domain) 13 gv_check(domain,(m as i64)>0,ctr) 14 if (m as i64)<=0 { return 0 } 15 gv_check("growth model captured" as *u8,(m.growth as i64)>0,ctr) 16 if (m.growth as i64)>0 { 17 gv_check("real growth parse valid" as *u8,m.growth.error==0,ctr) 18 gv_check("no invented real learning path" as *u8,m.growth.count==0,ctr) 19 } 20 w(fd,","); wq(fd); wj(fd,domain); w(fd,"\":{\"capture\":true" as *u8); sg_json(m,fd); w(fd,"}" as *u8) 21 return 0 22} 23func main(argc: i64,argv: *i64) -> i64 { 24 if argc!=2 { return 2 } 25 let prefix: *u8=argv[1] as *u8 26 if starts(prefix,"/tmp/cg-" as *u8)!=1 { return 2 } 27 let pn: i64=sg_len(prefix) 28 if sg_id(((prefix as i64)+5) as *u8,pn-5)!=1 { return 2 } 29 let jsonpath: *u8=cgi_path(prefix,".json" as *u8); let htmlpath: *u8=cgi_path(prefix,".html" as *u8) 30 if (jsonpath as i64)==0 { return 2 }; if (htmlpath as i64)==0 { return 2 } 31 let ctr: *i64=gv_ctr(); gv_head("COMPARE-GROWTH-INTEGRATION" as *u8) 32 let fd: i64=sys_openat_exclusive(jsonpath,0x180); if fd<0 { return 3 } 33 let hf: i64=sys_openat_exclusive(htmlpath,0x180); if hf<0 { sys_close(fd); return 3 } 34 w(fd,"{\"capture\":true" as *u8) 35 cgi_domain("gameengine" as *u8,fd,ctr) 36 cgi_domain("charsim" as *u8,fd,ctr) 37 cgi_domain("ecosystem" as *u8,fd,ctr) 38 cgi_domain("deploy" as *u8,fd,ctr) 39 cgi_domain("dataio" as *u8,fd,ctr) 40 let text: *u8="rung|R1|Test|f|done|Organ|1|-\nsotatarget|T1|frontier|B1|Target|ref\ngrowthpath|1|P1|R1|proactive_research|T1|ref|A model <script>alert(\"x\")</script> & Ω|Still unknown\ngrowthexercise|1|E1|P1|-|f|nx_probe|workload|resources|accept|@research\ngrowthexercise|1|E2|P1|E1|f|nx_probe|workload|resources|accept|@learning\ngrowthassessment|1|A1|P1|scope|innovation|receipt|1789030000|reviewer|-\n" as *u8 41 let m: *SgPlan=sg_parse(text,sg_len(text),0 as *u8,0,0 as *u8,0) 42 gv_check("fixture graph valid" as *u8,sg_valid(m)==1,ctr) 43 gv_check("fixture growth valid" as *u8,m.growth.error==0,ctr) 44 gv_check("fixture one path" as *u8,m.growth.paths==1,ctr) 45 gv_check("fixture two exercises" as *u8,m.growth.exercises==2,ctr) 46 gv_check("fixture assessment retained" as *u8,m.growth.assessments==1,ctr) 47 w(fd,",\"synthetic\":{\"capture\":true" as *u8); sg_json(m,fd); w(fd,"}" as *u8) 48 w(hf,"<!doctype html><html lang='en'><meta charset='utf-8'><meta name='viewport' content='width=device-width,initial-scale=1'><title>Private Compare growth qualification</title><style>" as *u8); sg_css(hf); w(hf,"</style><body><main><h1>Private synthetic qualification</h1>" as *u8) 49 sg_html(m,hf) 50 var planbytes: i64=0; var rn: i64=0 51 let plan: *u8=sys_read_file("knowledge/compare/gameengine.plan" as *u8,&planbytes) 52 let rows: *u8=sys_read_file("/tmp/cg-gameengine-rows-20260910.plan" as *u8,&rn) 53 gv_check("current gameengine source read" as *u8,planbytes>0,ctr) 54 gv_check("candidate real growth rows read" as *u8,rn>0,ctr) 55 if planbytes>0 { if rn>0 { 56 let merged: *u8=sys_mmap(planbytes+rn+2); var k: i64=0 57 while k<planbytes { merged[k]=plan[k]; k=k+1 } 58 merged[k]=10 as u8; k=k+1 59 var j: i64=0 60 while j<rn { merged[k]=rows[j]; k=k+1; j=j+1 } 61 merged[k]=0 as u8 62 let real: *SgPlan=sg_parse(merged,k,0 as *u8,0,0 as *u8,0) 63 gv_check("original graph invalidity retained" as *u8,sg_valid(real)==0,ctr) 64 gv_check("independent real growth valid" as *u8,real.growth.error==0,ctr) 65 gv_check("four real learning paths" as *u8,real.growth.paths==4,ctr) 66 gv_check("nine real practice exercises" as *u8,real.growth.exercises==9,ctr) 67 gv_check("two unverified real assessments" as *u8,real.growth.assessments==2,ctr) 68 w(fd,",\"gameengine_candidate\":{\"capture\":true" as *u8); sg_json(real,fd); w(fd,"}" as *u8) 69 w(hf,"<h1>Private current gameengine plan plus candidate growth rows</h1>" as *u8); sg_html(real,hf) 70 } } 71 w(fd,"}\n" as *u8) 72 w(hf,"</main></body></html>\n" as *u8) 73 gv_check("JSON fsync" as *u8,sys_fsync(fd)==0,ctr); gv_check("JSON close" as *u8,sys_close(fd)==0,ctr) 74 gv_check("HTML fsync" as *u8,sys_fsync(hf)==0,ctr); gv_check("HTML close" as *u8,sys_close(hf)==0,ctr) 75 var jn: i64=0; let jb: *u8=sys_read_file(jsonpath,&jn) 76 gv_check("JSON retained" as *u8,jn>0,ctr) 77 if jn>0 { gv_check("growth JSON key" as *u8,gk_has(jb,"\"capability_growth\":" as *u8),ctr); gv_check("dispatch remains withheld" as *u8,gk_has(jb,"\"recommendation_state\":\"WITHHELD\"" as *u8),ctr) } 78 var hn: i64=0; let hb: *u8=sys_read_file(htmlpath,&hn) 79 gv_check("HTML retained" as *u8,hn>0,ctr) 80 if hn>0 { 81 gv_check("growth section emitted" as *u8,gk_has(hb,"Learning and practice paths" as *u8),ctr) 82 gv_check("HTML raw script refused" as *u8,gk_has(hb,"<script>alert" as *u8)==0,ctr) 83 gv_check("HTML escaped script retained" as *u8,gk_has(hb,"&lt;script&gt;" as *u8),ctr) 84 gv_check("readiness remains unverified" as *u8,gk_has(hb,"readiness unverified" as *u8),ctr) 85 gv_check("assessment caveat visible" as *u8,gk_has(hb,"evidence not validated" as *u8),ctr) 86 } 87 gv_puts("json=" as *u8); gv_puts(jsonpath); gv_puts("\nhtml=" as *u8); gv_puts(htmlpath); gv_puts("\n" as *u8) 88 return gv_verdict("COMPARE-GROWTH-FINAL" as *u8,ctr,"private authored paths; not eligible dispatch or verified mastery" as *u8) 89}