code wiki / _hdl_build / nx_condition_report.nx
nx_condition_report.nx
buildroot/runtime/_hdl_build/nx_condition_report.nx
about
nx_condition_report.nx -- MANHEIM-BUILD-L3 (assurance/trust): the CONDITION REPORT GRADER (Manheim
Condition Report / AutoGrade-class), the inspection grade every wholesale lot carries. Sovereign
(nx_cc->nxasm, no gcc), integer-exact + deterministic.
WHY GRADE INTEGRITY IS THE WHOLE GAME: the grade drives the price AND it is the #1 source of ARBITRATION
disputes. A naive grader that AVERAGES category scores produces DANGEROUSLY WRONG grades for
structurally-compromised cars -- a frame-damaged car with pristine cosmetics averages out to "excellent",
which a buyer will arbitrate (and which then poisons any valuation built on it). The fix: a CRITICAL
DEFECT must CAP the grade, never be washed out by good panels.
ENGINE:
cr_naive = weighted category average / 2 (ext 30 / int 20 / mech 30 / tires 10 / glass 10, sum 100)
cr_grade = cr_naive, but CAPPED at the structural ceiling (2.0 = 20) if ANY critical flag is set
(frame damage / flood / airbag-deployed / salvage brand). grade scale 0..50 (= 0.0..5.0).
===== S-CLASS EXCEED, MEASURED (no-wave law) =====
main() is an EXCEED BENCH vs the naive averaging grader on grade INTEGRITY (deterministic, non-circular):
A (frame damage + pristine cosmetics): naive overgrades to 47 ("4.7 excellent" -- WRONG/dangerous);
ours CAPS at 20 ("2.0 structural") -> a 27-point integrity gap the naive grader gets wrong.
NEG-CONTROL B (same pristine cosmetics, NO critical flag): ours == naive == 47 -> ours does NOT
always-cap, it tracks real condition (proves the cap is defect-triggered, not a blanket clamp).
C (monotonicity): a clearly-worse car grades strictly lower. + determinism.
HONEST SCOPE (no-overclaim): the measured exceed is grade INTEGRITY vs the naive-average baseline -- NOT a
claim to reproduce a specific human inspector's grade or Manheim's exact proprietary AutoGrade algorithm
(those need real inspection data = operator-host). Evidence -> knowledge/status/condition_report.log.
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
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
structs
| none |
consts
| 30 | const CR_LOG: *u8 = "knowledge/status/condition_report.log" |
| 31 | const CR_W_EXT: i64 = 30 |
| 32 | const CR_W_INT: i64 = 20 |
| 33 | const CR_W_MECH: i64 = 30 |
| 34 | const CR_W_TIRES: i64 = 10 |
| 35 | const CR_W_GLASS: i64 = 10 |
| 36 | const CR_STRUCTURAL_CAP: i64 = 20 // 2.0 grade ceiling for any structural/branded defect |
| 37 | const CR_SCALE: i64 = 50 // max grade (= 5.0) |
functions
| 39 | func cr_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 } |
| 40 | func cr_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 } |
| 43 | func cr_naive(ext: i64, intr: i64, mech: i64, tires: i64, glass: i64) -> i64 |
| 48 | func cr_grade(ext: i64, intr: i64, mech: i64, tires: i64, glass: i64, frame: i64, flood: i64, airbag: i64, salvage: i64) -> i64 |
| 59 | func main() -> i64 |