code wiki / _hdl_build / nx_connect_lanes.nx
nx_connect_lanes.nx source
↩ module page · 77 lines · 5106 B
1// nx_connect_lanes.nx -- R2 of CONNECT: the structured per-relationship INTENT-LANE consent
2// state machine. This is the honest, consented alternative to Tandem's banned-but-leaking dating
3// (and HelloTalk's cosmetic toggle). A relationship's ACTIVE lane is the level BOTH parties have
4// opted into = MIN(a_request, b_request) -- so ESCALATION needs MUTUAL consent (anti-creep by
5// construction: no one can be pulled toward romance unilaterally). DE-ESCALATION / BLOCK is
6// UNILATERAL and immediate (safety asymmetry: hard to escalate, easy to exit). Any relationship
7// involving a MINOR is hard-capped below the romance lane -- dating is structurally unreachable.
8//
9// Lanes: LANGUAGE(0) < FRIEND(1) < COMMUNITY(2) < DATE(3). Pure integer state logic (no floats).
10// Gate has 7 checks incl. a measured NEGATIVE CONTROL: the incumbent-style "either party escalates"
11// (max, no minor cap) WOULD non-consensually push a user toward dating -- proving the mutual-opt-in
12// MIN rule is what enforces consent. Mirrors the nx_*_census/gate idiom.
13// 100% sovereign. license_tier: ORIGINAL expect_exit: 0
14import "nx_syscalls.nx"
15import "nx_connect_lanes_lib.nx"
16
17func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
18func sn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} 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 }
19
20func tcheck(pass: i64, label: *u8, fails: *i64) -> i64 {
21 sw(" " as *u8); sw(label); sw(": " as *u8)
22 if pass==1 { sw("PASS\n" as *u8) } else { sw("FAIL\n" as *u8); fails[0]=fails[0]+1 }
23 return 0
24}
25
26func main() -> i64 {
27 let fails: *i64 = sys_mmap(16) as *i64
28 fails[0]=0
29
30 // scenario lanes (a_req, b_req, a_adult, b_adult, blocked):
31 let s_default: i64 = ln_active_lane(LN_LANE_LANG, LN_LANE_LANG, 1,1, 0) // both default to language
32 let s_unilat: i64 = ln_active_lane(LN_LANE_DATE, LN_LANE_LANG, 1,1, 0) // A wants dating, B only language
33 let s_mutual_fr: i64 = ln_active_lane(LN_LANE_FRIEND, LN_LANE_FRIEND, 1,1, 0)
34 let s_minor_cap: i64 = ln_active_lane(LN_LANE_DATE, LN_LANE_DATE, 0,1, 0) // both want dating, A is a MINOR
35 let s_adult_date:i64 = ln_active_lane(LN_LANE_DATE, LN_LANE_DATE, 1,1, 0) // both adults, both consent
36 let s_blocked: i64 = ln_active_lane(LN_LANE_DATE, LN_LANE_DATE, 1,1, 1) // blocked
37 let n_unilat: i64 = ln_naive_lane(LN_LANE_DATE, LN_LANE_LANG, 1,1, 0) // neg-control of the unilateral case
38
39 sw("=== nx_connect_lanes R2 -- intent-lane consent state machine (honest 2026-06-20) ===\n" as *u8)
40 sw("lanes: LANGUAGE(0) < FRIEND(1) < COMMUNITY(2) < DATE(3) ; active = MIN(both requests), minor-capped\n" as *u8)
41 sw(" default (both language) = " as *u8); sn(s_default); sw("\n" as *u8)
42 sw(" A wants DATE, B wants LANGUAGE = " as *u8); sn(s_unilat); sw(" (stays LANGUAGE: no unilateral escalation)\n" as *u8)
43 sw(" both opt into FRIEND = " as *u8); sn(s_mutual_fr); sw("\n" as *u8)
44 sw(" both want DATE but A is a MINOR = " as *u8); sn(s_minor_cap); sw(" (capped at COMMUNITY: romance unreachable)\n" as *u8)
45 sw(" both adults both opt into DATE = " as *u8); sn(s_adult_date);sw("\n" as *u8)
46 sw(" blocked = " as *u8); sn(s_blocked); sw(" (EXCLUDED: unilateral exit)\n" as *u8)
47 sw(" NEG-CONTROL naive(unilateral) lane = " as *u8); sn(n_unilat); sw(" (incumbent-style leak -> DATE)\n" as *u8)
48 sw("-- gate checks --\n" as *u8)
49
50 var t1: i64=0; if s_default==LN_LANE_LANG { t1=1 }
51 tcheck(t1, "T1 default relationship starts at LANGUAGE" as *u8, fails)
52
53 var t2: i64=0; if s_unilat==LN_LANE_LANG { t2=1 }
54 tcheck(t2, "T2 unilateral DATE request does NOT escalate (anti-creep)" as *u8, fails)
55
56 var t3: i64=0; if s_mutual_fr==LN_LANE_FRIEND { t3=1 }
57 tcheck(t3, "T3 mutual opt-in escalates LANGUAGE->FRIEND" as *u8, fails)
58
59 var t4: i64=0; if s_minor_cap<LN_LANE_DATE { t4=1 }
60 tcheck(t4, "T4 SAFETY minor-involved relationship capped below romance" as *u8, fails)
61
62 var t5: i64=0; if s_adult_date==LN_LANE_DATE { t5=1 }
63 tcheck(t5, "T5 both adults + mutual consent reach DATE" as *u8, fails)
64
65 var t6: i64=0; if s_blocked<0 { t6=1 }
66 tcheck(t6, "T6 block is unilateral and immediate (safety asymmetry)" as *u8, fails)
67
68 // NEG-CONTROL: our mutual-opt-in keeps the unilateral case at LANGUAGE where the naive rule leaks to DATE
69 var t7: i64=0; if s_unilat==LN_LANE_LANG { if n_unilat==LN_LANE_DATE { t7=1 } }
70 tcheck(t7, "T7 NEG-CONTROL mutual-opt-in=LANGUAGE but naive=DATE (consent enforced)" as *u8, fails)
71
72 sw(" fails=" as *u8); sn(fails[0]); sw("\n" as *u8)
73 if fails[0]==0 { sw("VERDICT: GREEN (escalation needs mutual consent; minors walled from romance; block is unilateral)\n" as *u8); sys_exit(0) }
74 sw("VERDICT: RED\n" as *u8)
75 sys_exit(1)
76 return 1
77}