nx_extllm_spent_cli_gate_20260910.nx source
↩ module page · 47 lines · 2273 B
1// Regression gate: runs the actual staged CLI; no provider call or live installation.
2import "nx_tool_run.nx"
3import "nx_gate_verdict.nx"
4import "nx_sovjson_lib.nx"
5const EG_CAPTURE_BYTES:i64=4096
6const EG_TEST_DEADLINE_MS:i64=10000
7func eg_case(elf:*u8, ledger:*u8, expected_rc:i64, expected:*u8, ctr:*i64) -> i64 {
8 let av:*i64=sys_mmap(40) as *i64
9 av[0]=elf as i64; av[1]="spent" as *u8 as i64; av[2]="fixture" as *u8 as i64; av[3]=ledger as i64; av[4]=0
10 let out:*u8=sys_mmap(EG_CAPTURE_BYTES)
11 let n:*i64=sys_mmap(16) as *i64
12 let cut:*i64=sys_mmap(16) as *i64
13 let rc:i64=tr_run_capture_tr(elf,av,out,EG_CAPTURE_BYTES,n,EG_TEST_DEADLINE_MS,cut)
14 sys_write(1,out,n[0])
15 gv_check(ledger,rc==expected_rc && cut[0]==0 && tr_contains(out,n[0],expected)==1,ctr)
16 return rc
17}
18func eg_exact(a:*u8,b:*u8)->bool {
19 var i:i64=0
20 while a[i]==b[i] { if a[i]==0 as u8 { return true }; i=i+1 }
21 return false
22}
23func main(argc:i64, argv:*i64)->i64 {
24 var elf:*u8=0 as *u8
25 var missing:*u8=0 as *u8
26 var empty:*u8=0 as *u8
27 var populated:*u8=0 as *u8
28 if argc==5 {
29 elf=argv[1] as *u8; missing=argv[2] as *u8; empty=argv[3] as *u8; populated=argv[4] as *u8
30 } else {
31 if argc!=4 { return 2 }
32 if !eg_exact(argv[1] as *u8,"spent" as *u8) { return 2 }
33 if !eg_exact(argv[2] as *u8,"fixture" as *u8) { return 2 }
34 if !eg_exact(argv[3] as *u8,"knowledge/gates/extllm-spent-populated-20260910.ledger" as *u8) { return 2 }
35 // Ship forwards this real CLI workload to adoptgate; test the artifact promote will consume.
36 elf="/volume1/homes/elderwesto/nishihost/nx_extllm.sov.elf.new" as *u8
37 missing="knowledge/gates/extllm-spent-missing-20260910.ledger" as *u8
38 empty="knowledge/gates/extllm-spent-empty-20260910.ledger" as *u8
39 populated=argv[3] as *u8
40 }
41 let ctr:*i64=gv_ctr()
42 gv_head("actual staged extllm spent missing-empty-populated CLI" as *u8)
43 eg_case(elf,missing,3,"\"bytes_disclosed_all_time\":null" as *u8,ctr)
44 eg_case(elf,empty,0,"\"bytes_disclosed_all_time\":0,\"ledger_bytes\":0" as *u8,ctr)
45 eg_case(elf,populated,0,"\"bytes_disclosed_all_time\":42," as *u8,ctr)
46 return gv_verdict("EXTLLM-SPENT-CLI" as *u8,ctr,"missing evidence refuses; actual empty zero; provider-filtered populated exact42bytes; not modeltokens or complete readerror protection" as *u8)
47}