code wiki / _hdl_build / nx_build_pipeline_test.nx
nx_build_pipeline_test.nx source
↩ module page · 62 lines · 3410 B
1// nx_build_pipeline_test.nx -- ACCEPTANCE GATE for the autonomous build pipeline. Proves the full
2// clean-RACI flow + the HONEST autonomy measurement (where Claude is still needed).
3import "nx_build_pipeline.nx"
4import "nx_syscalls.nx"
5
6func pt_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
7func pt_putn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 }
8
9func main() -> i64 {
10 var pass: i64 = 0
11 var total: i64 = 0
12
13 // clean roles: Builder author, Engineer test, Doctor heal, 1 Council accountable
14 let AU: i64 = BR_BUILDER
15 let TE: i64 = BR_ENGINEER
16 let HE: i64 = BR_DOCTOR
17
18 // T1: grounded + pattern-covered core + test passes -> ADMITTED, fully autonomous (claude_touch=0)
19 total = total + 1
20 var t1: i64 = 1
21 if bp_run(1, 7, AU, TE, HE, 1, 1, 0, 2) != BP_ADMITTED { t1 = 0 } // pattern_id=7
22 if bp_claude_touch(7) != 0 { t1 = 0 }
23 if t1 == 1 { pass = pass + 1 } else { pt_puts("T1 FAIL admit v=" as *u8); pt_putn(bp_run(1,7,AU,TE,HE,1,1,0,2)); pt_puts("\n" as *u8) }
24
25 // T2: NOVEL core (pattern_id=0) -> NEEDS_TUTOR flagged, claude_touch=1 (the honest gap)
26 total = total + 1
27 var t2: i64 = 1
28 if bp_run(1, 0, AU, TE, HE, 1, 1, 0, 2) != BP_NEEDS_TUTOR { t2 = 0 }
29 if bp_claude_touch(0) != 1 { t2 = 0 }
30 if t2 == 1 { pass = pass + 1 } else { pt_puts("T2 FAIL tutor\n" as *u8) }
31
32 // T3: pattern-covered but test FAILS with heal budget -> HEALED (routed to Doctor)
33 total = total + 1
34 if bp_run(1, 7, AU, TE, HE, 1, 0, 0, 2) == BP_HEALED { pass = pass + 1 } else { pt_puts("T3 FAIL heal\n" as *u8) }
35
36 // T4: after heal, re-test PASSES -> ADMITTED
37 total = total + 1
38 if bp_after_heal(1, 7, AU, TE, HE, 1, 1, 1, 2) == BP_ADMITTED { pass = pass + 1 } else { pt_puts("T4 FAIL post-heal-admit\n" as *u8) }
39
40 // T5: after heal, still FAILS + budget exhausted -> REJECTED (never false-admit)
41 total = total + 1
42 if bp_after_heal(1, 7, AU, TE, HE, 1, 0, 2, 2) == BP_REJECTED { pass = pass + 1 } else { pt_puts("T5 FAIL reject\n" as *u8) }
43
44 // T6: UNGROUNDED assignment (PM thin-air) -> REJECTED before any build
45 total = total + 1
46 if bp_run(0, 7, AU, TE, HE, 1, 1, 0, 2) == BP_REJECTED { pass = pass + 1 } else { pt_puts("T6 FAIL ungrounded\n" as *u8) }
47
48 // T7: RACI VIOLATION -- Doctor as tester (the blur) -> RACI_BAD, pipeline refuses to run
49 total = total + 1
50 if bp_run(1, 7, AU, BR_DOCTOR, BR_ENGINEER, 1, 1, 0, 2) == BP_RACI_BAD { pass = pass + 1 } else { pt_puts("T7 FAIL raci\n" as *u8) }
51
52 // T8: AUTONOMY metric -- 3 of 4 assignments pattern-covered = 750 permil autonomous (1 needs Claude)
53 total = total + 1
54 let pats: *i64 = sys_mmap(64) as *i64
55 pats[0]=7; pats[1]=3; pats[2]=0; pats[3]=5 // one novel (0) -> 3/4 autonomous
56 if bp_autonomy_permil(pats, 4) == 750 { pass = pass + 1 } else { pt_puts("T8 FAIL autonomy=" as *u8); pt_putn(bp_autonomy_permil(pats, 4)); pt_puts("\n" as *u8) }
57
58 pt_puts("BUILD-PIPELINE " as *u8); pt_putn(pass); pt_puts("/" as *u8); pt_putn(total); pt_puts("\n" as *u8)
59 if pass == total { pt_puts("BUILD-PIPELINE ALL-PASS\n" as *u8); sys_exit(0) }
60 sys_exit(1)
61 return 1
62}