code wiki / _hdl_build / nx_arbitration.nx

nx_arbitration.nx

buildroot/runtime/_hdl_build/nx_arbitration.nx

7310 B125 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_arbitration.nx -- MANHEIM-BUILD-L3 (assurance/trust): the ARBITRATION ELIGIBILITY engine (Manheim / NAAA-class dispute resolution), the rules that decide whether a buyer's post-sale claim is arbitrable. Sovereign (nx_cc->nxasm, no gcc), deterministic. WHY IT MATTERS: arbitration disputes are a major friction + cost in wholesale. The failure mode of an opaque / single-factor process is INCONSISTENCY and OVER-ADMISSION -- a claim that is expensive but time-barred, sold as-is, or in a non-arbitrable category gets let through by a "is it expensive?" heuristic, creating cost + unfairness. Correct eligibility is CONJUNCTIVE: every condition must hold. ENGINE (auditable -- returns the precise failing reason): ELIGIBLE iff ALL: repair_cost >= threshold AND filed within window AND arbitrable category AND NOT as-is. reason codes: 0=eligible 1=below_threshold 2=window_expired 3=non_arbitrable_category 4=as_is_sale naive baseline = checks ONLY the dollar threshold (the over-admitting heuristic). ===== S-CLASS EXCEED, MEASURED (no-wave law) ===== main() benches ours vs the naive dollar-only arbiter over 4 claims (deterministic, non-circular): A genuine claim -> both ELIGIBLE (ours admits real claims). B expensive-but-LATE + C expensive-but-AS-IS -> naive OVER-ADMITS (wrong), ours REJECTS with the exact reason. D below-threshold -> both reject. MEASURED: naive over-admits 2 of 4 (the time-barred + as-is claims); ours over-admits 0. NEG-CONTROL is built in: D shows ours still rejects on the dollar rule (not a blanket-reject), and A shows ours admits genuine claims (not a blanket-admit) -> the discrimination is real. HONEST SCOPE (no-overclaim): exceed is conjunctive-correctness + determinism vs the naive single-factor baseline -- NOT a claim to match a specific real NAAA/Manheim arbitration policy's exact thresholds, windows, or category list (those are policy params = config / operator). Evidence -> knowledge/status/arbitration.log. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_arbitration.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ar_rule ar_eligible ar_naive ar_w sys_write ar_wn sys_mmap sys_write ↻ sys_openat_append sys_close

structs

none

consts

28const AR_MAGIC_80000: i64 = 80000
29const AR_MAGIC_40000: i64 = 40000
31const AR_LOG: *u8 = "knowledge/status/arbitration.log"
32const AR_THRESHOLD: i64 = 60000 // $600 minimum repair cost to arbitrate (modeled)
33const AR_WINDOW: i64 = 168 // 168h (7 days) filing window (modeled)

functions

35func ar_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: main calls 1: sys_write
36func ar_wn(fd: i64, v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8 = sys_mmap(28); var k: i64=0; if m==0 {t[0]=48;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(fd, bb, k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
39func ar_rule(cost: i64, hours: i64, arbitrable: i64, as_is: i64) -> i64
called by 1: main
46func ar_eligible(reason: i64) -> i64 { if reason == 0 { return 1 } return 0 }
called by 1: main
48func ar_naive(cost: i64) -> i64 { if cost >= AR_THRESHOLD { return 1 } return 0 }
called by 1: main
50func main() -> i64