code wiki / _hdl_build / nx_meet_signals_gate.nx

nx_meet_signals_gate.nx source

↩ module page · 64 lines · 5436 B

1// nx_meet_signals_gate.nx -- liar-kill gate for P5 (editable signal table). Proves: (1) the data-driven scorer 2// (nx_meet_signals, default table) reproduces the HARDCODED reference (nx_meet_trust) on ALL 16 R6 fixtures -- so 3// externalizing the signals regresses NOTHING; (2) it is non-trivial (flags a known fake, passes a known real); 4// (3) TUNABILITY -- adding one `sig|resume|fake|50|rockstar coder` line flags a sample the default table passes. 5// expect_exit: 0 6import "nx_syscalls.nx" 7import "nx_meet_lib.nx" 8import "nx_meet_trust.nx" 9import "nx_meet_signals.nx" 10 11func main() -> i64 { 12 mputs("=== nx_meet_signals_gate: editable signal table == hardcoded reference + tunable ===\n" as *u8) 13 let def: *u8 = sig_default(); let dn: i64 = mlen(def) 14 15 let rf: *i64 = sys_mmap(64) as *i64 16 rf[0] = "As an AI language model, I am a results-driven professional with synergy and a proven track record. Detail-oriented go-getter who can hit the ground running." as *u8 as i64 17 rf[1] = "Passionate team player and self-starter. I think outside the box and bring synergy to every results-driven team. Detail-oriented professional." as *u8 as i64 18 rf[2] = "A go-getter with a proven track record. Results-driven professional, detail-oriented, ready to hit the ground running and think outside the box." as *u8 as i64 19 rf[3] = "Dynamic results-driven professional. Passionate team player with synergy. As an AI, I leverage detail-oriented skills." as *u8 as i64 20 let rr: *i64 = sys_mmap(64) as *i64 21 rr[0] = "Built payment service handling 12000 req/s at Acme; cut latency 38 percent. Contact jane@example.com, github.com/jane. 6 years Go and Rust." as *u8 as i64 22 rr[1] = "Registered Nurse, 8 years ICU at Plano Medical. TX license 12345. References on request, sam@example.com." as *u8 as i64 23 rr[2] = "CNC machinist, 5-axis, 3 yrs at Local Tool Co. Portfolio http://example.com/work. Reduced scrap 22 percent." as *u8 as i64 24 rr[3] = "Staff accountant; closed books in 4 days at Frisco LLC; managed a 2M general ledger. dana@example.com" as *u8 as i64 25 let pf: *i64 = sys_mmap(64) as *i64 26 pf[0] = "Competitive salary in a fast-paced environment. Be your own boss with unlimited earning potential! We are always hiring rockstars and ninjas who wear many hats." as *u8 as i64 27 pf[1] = "Work hard play hard, we are like a family! Fast-paced environment, competitive salary, always hiring. Wear many hats, be a rockstar." as *u8 as i64 28 pf[2] = "Unlimited earning potential, be your own boss! Competitive salary, fast-paced environment. Ninjas and rockstars wanted." as *u8 as i64 29 pf[3] = "We are like a family in a fast-paced environment. Always hiring. Competitive salary, wear many hats." as *u8 as i64 30 let pr: *i64 = sys_mmap(64) as *i64 31 pr[0] = "Senior Engineer at Acme (https://acme.com), McKinney TX. Salary range 140,000 to 170,000 USD. Build our payments platform. Contact careers@acme.com." as *u8 as i64 32 pr[1] = "ICU RN, Plano Medical Center, Plano TX. Pay 38 to 48 per hour, nights. Apply https://planomed.org/jobs. TX license required." as *u8 as i64 33 pr[2] = "CNC Machinist, Local Tool Co, McKinney TX. 28 dollars per hour, contract-to-hire. 5-axis. http://localtool.com" as *u8 as i64 34 pr[3] = "Staff Accountant, Frisco LLC, remote. 70,000 to 85,000 USD. Month-end close. https://friscollc.com/careers" as *u8 as i64 35 36 var agree: i64 = 0 37 var i: i64 = 0 38 while i < 4 { if sig_is_fake(rf[i] as *u8, 0, def, dn) == trust_is_fake_resume(rf[i] as *u8) { agree = agree + 1 } i = i + 1 } 39 i = 0 40 while i < 4 { if sig_is_fake(rr[i] as *u8, 0, def, dn) == trust_is_fake_resume(rr[i] as *u8) { agree = agree + 1 } i = i + 1 } 41 i = 0 42 while i < 4 { if sig_is_fake(pf[i] as *u8, 1, def, dn) == trust_is_ghost_posting(pf[i] as *u8) { agree = agree + 1 } i = i + 1 } 43 i = 0 44 while i < 4 { if sig_is_fake(pr[i] as *u8, 1, def, dn) == trust_is_ghost_posting(pr[i] as *u8) { agree = agree + 1 } i = i + 1 } 45 mputs(" data-driven vs hardcoded agreement=" as *u8); mnum(agree); mputs("/16\n" as *u8) 46 47 // tunability: add one signal -> flag a sample the default table passes 48 let custom: *u8 = sys_mmap(8192) 49 var co: i64 = mcat(custom, 0, def) 50 co = mcat(custom, co, "sig|resume|fake|50|rockstar coder\n" as *u8) 51 let cn: i64 = co 52 let sample: *u8 = "I am a rockstar coder with jane@example.com 12345 github" as *u8 53 54 var pass: i64 = 0; var fail: i64 = 0 55 if agree == 16 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL not-equivalent-to-reference\n" as *u8) } 56 if sig_is_fake(rf[0] as *u8, 0, def, dn) == 1 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL doesnt-flag-known-fake\n" as *u8) } 57 if sig_is_fake(rr[0] as *u8, 0, def, dn) == 0 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL flags-known-real\n" as *u8) } 58 if sig_is_fake(sample, 0, def, dn) == 0 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL default-already-flags-sample\n" as *u8) } 59 if sig_is_fake(sample, 0, custom, cn) == 1 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL tuned-table-doesnt-flag\n" as *u8) } 60 61 mputs("MEET-SIGNALS-GATE pass=" as *u8); mnum(pass); mputs(" fail=" as *u8); mnum(fail) 62 if fail == 0 { mputs(" verdict=GREEN (editable signal table reproduces the gated reference 16/16 + is tunable -- no regression)\n" as *u8); sys_exit(0); return 0 } 63 mputs(" verdict=RED\n" as *u8); sys_exit(1); return 1 64}