code wiki / _hdl_build / nx_meet_signals_gate.nx
nx_meet_signals_gate.nx source
↩ module page · 72 lines · 5821 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"
10import "nx_gate_verdict.nx"
11
12func main() -> i64 {
13 mputs("=== nx_meet_signals_gate: editable signal table == hardcoded reference + tunable ===\n" as *u8)
14 let def: *u8 = sig_default(); let dn: i64 = mlen(def)
15
16 let rf: *i64 = sys_mmap(64) as *i64
17 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
18 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
19 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
20 rf[3] = "Dynamic results-driven professional. Passionate team player with synergy. As an AI, I leverage detail-oriented skills." as *u8 as i64
21 let rr: *i64 = sys_mmap(64) as *i64
22 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
23 rr[1] = "Registered Nurse, 8 years ICU at Plano Medical. TX license 12345. References on request, sam@example.com." as *u8 as i64
24 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
25 rr[3] = "Staff accountant; closed books in 4 days at Frisco LLC; managed a 2M general ledger. dana@example.com" as *u8 as i64
26 let pf: *i64 = sys_mmap(64) as *i64
27 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
28 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
29 pf[2] = "Unlimited earning potential, be your own boss! Competitive salary, fast-paced environment. Ninjas and rockstars wanted." as *u8 as i64
30 pf[3] = "We are like a family in a fast-paced environment. Always hiring. Competitive salary, wear many hats." as *u8 as i64
31 let pr: *i64 = sys_mmap(64) as *i64
32 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
33 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
34 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
35 pr[3] = "Staff Accountant, Frisco LLC, remote. 70,000 to 85,000 USD. Month-end close. https://friscollc.com/careers" as *u8 as i64
36
37 var agree: i64 = 0
38 var i: i64 = 0
39 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 }
40 i = 0
41 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 }
42 i = 0
43 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 }
44 i = 0
45 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 }
46 mputs(" data-driven vs hardcoded agreement=" as *u8); mnum(agree); mputs("/16\n" as *u8)
47
48 // tunability: add one signal -> flag a sample the default table passes
49 let custom: *u8 = sys_mmap(8192)
50 var co: i64 = mcat(custom, 0, def)
51 co = mcat(custom, co, "sig|resume|fake|50|rockstar coder\n" as *u8)
52 let cn: i64 = co
53 let sample: *u8 = "I am a rockstar coder with jane@example.com 12345 github" as *u8
54
55 var pass: i64 = 0; var fail: i64 = 0
56 if agree == 16 { pass=pass+1 } else { fail=fail+1; mputs(" FAIL not-equivalent-to-reference\n" as *u8) }
57 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) }
58 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) }
59 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) }
60 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) }
61
62 mputs("MEET-SIGNALS-GATE pass=" as *u8); mnum(pass); mputs(" fail=" as *u8); mnum(fail)
63 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, minimal form): every check
64 // row above is untouched, so the PASS/FAIL vector cannot change; only the hand-rolled
65 // verdict emission is replaced by the ONE shared base class. Proven by nx_gate_migrate verify.
66 let ctr__dry: *i64 = gv_ctr()
67 ctr__dry[0] = pass
68 ctr__dry[1] = pass + fail
69 let rc__dry: i64 = gv_verdict("MEET-SIGNALS-GATE" as *u8, ctr__dry, "editable signal table reproduces the gated reference 16/16 + is tunable -- no regression)" as *u8)
70 sys_exit(rc__dry)
71 return rc__dry
72}