code wiki / _hdl_build / nx_ecomat_trend.nx

nx_ecomat_trend.nx source

↩ module page · 75 lines · 4753 B

1// nx_ecomat_trend.nx -- "are we actually advancing, or just declaring more frontiers?" 2// Reads the durable maturity ledger and splits its movement into ADVANCEMENT (an existing domain 3// climbed a rung -- measured exactly across spans where the cohort was stable) and EXPANSION (new 4// domains declared, which raise the bar and therefore DEPRESS the sum_cur/sum_bar headline). 5// 6// Why this organ exists: the headline alone is directionally misleading by construction. The same 7// ledger that reads "460 -> 434 permil, we regressed" also says sum_cur rose 47 -> 53. Both are 8// true; only the decomposition tells you which one is capability. 9// 10// argv[1] = ledger path (default knowledge/status/ecosystem_maturity.log) 11// verdict=GREEN/RED reports the INSTRUMENT. The ecosystem's own state is the separate `finding=` 12// field -- a truthful FLAT must never be reportable as a broken gauge. 13// license_tier: ORIGINAL No hw writes (Rule 26). 14import "nx_ecomat_trend_lib.nx" 15 16func main(argc: i64, argv: *i64) -> i64 { 17 var logp: *u8 = TR_LEDGER 18 if argc >= 2 { logp = argv[1] as *u8 } 19 20 _p("=== NX-ECOMAT-TREND: advancement vs expansion over the durable maturity ledger ===\n" as *u8) 21 let out: *i64 = sys_mmap(TR_OUT_SLOTS * TR_I64) as *i64 22 let rc: i64 = em_trend(logp, out) 23 24 if rc == TR_ERR_NOLOG { 25 _p(" ledger: " as *u8); _p(logp); _p("\n" as *u8) 26 _p("NX-ECOMAT-TREND verdict=RED reason=no-ledger (nothing to measure; run nx_ecosystem_maturity_rollup first)\n" as *u8) 27 sys_exit(101) 28 return 101 29 } 30 if rc == TR_ERR_THIN { 31 _p(" ledger: " as *u8); _p(logp); _p(" measurable rows=" as *u8); _fn(1, out[TRO_ROWS]) 32 _p(" of " as *u8); _fn(1, out[TRO_SCANNED]); _p(" scanned\n" as *u8) 33 _p("NX-ECOMAT-TREND verdict=RED reason=too-few-points (need 2 rows carrying sum_cur/sum_bar/domains to difference)\n" as *u8) 34 sys_exit(102) 35 return 102 36 } 37 38 _p(" ledger: " as *u8); _p(logp) 39 _p(" measurable rows=" as *u8); _fn(1, out[TRO_ROWS]) 40 _p(" of " as *u8); _fn(1, out[TRO_SCANNED]); _p(" scanned" as *u8) 41 if out[TRO_CAPPED] == 1 { _p(" CAPPED at " as *u8); _fn(1, TR_MAX_ROWS); _p(" rows (window is a FLOOR, not the whole ledger)" as *u8) } 42 _p("\n window epoch " as *u8); _fn(1, out[TRO_FIRST_EPOCH]); _p(" -> " as *u8); _fn(1, out[TRO_LAST_EPOCH]); _p("\n\n" as *u8) 43 44 _p("-- WHAT THE HEADLINE SAYS --\n" as *u8) 45 _p(" overall permil " as *u8); _fn(1, out[TRO_FIRST_PERMIL]); _p(" -> " as *u8); _fn(1, out[TRO_LAST_PERMIL]) 46 let dp: i64 = out[TRO_LAST_PERMIL] - out[TRO_FIRST_PERMIL] 47 _p(" (delta " as *u8); if dp >= 0 { _p("+" as *u8) } _fn(1, dp); _p(")\n\n" as *u8) 48 49 _p("-- WHAT ACTUALLY MOVED --\n" as *u8) 50 _p(" levels earned " as *u8); _fn(1, out[TRO_FIRST_CUR]); _p(" -> " as *u8); _fn(1, out[TRO_LAST_CUR]) 51 _p(" (delta +" as *u8); _fn(1, out[TRO_LAST_CUR] - out[TRO_FIRST_CUR]); _p(")\n" as *u8) 52 _p(" bar (the denominator) " as *u8); _fn(1, out[TRO_FIRST_BAR]); _p(" -> " as *u8); _fn(1, out[TRO_LAST_BAR]) 53 _p(" (delta +" as *u8); _fn(1, out[TRO_LAST_BAR] - out[TRO_FIRST_BAR]); _p(")\n" as *u8) 54 _p(" domains declared " as *u8); _fn(1, out[TRO_FIRST_DOM]); _p(" -> " as *u8); _fn(1, out[TRO_LAST_DOM]) 55 _p(" (added " as *u8); _fn(1, out[TRO_ADDED_DOM]); _p(")\n\n" as *u8) 56 57 _p("-- THE DECOMPOSITION --\n" as *u8) 58 _p(" ADVANCEMENT " as *u8); _fn(1, out[TRO_ADVANCE]) 59 _p(" levels, measured EXACTLY across " as *u8); _fn(1, out[TRO_STABLE_SPANS]) 60 _p(" stable-cohort spans (domain count unchanged => the whole delta is a rung climbed)\n" as *u8) 61 _p(" EXPANSION +" as *u8); _fn(1, out[TRO_EXPAND_BAR]) 62 _p(" bar from " as *u8); _fn(1, out[TRO_ADDED_DOM]) 63 _p(" newly declared domains -- this DEPRESSES the headline while adding no capability\n" as *u8) 64 _p(" AMBIGUOUS " as *u8); _fn(1, out[TRO_AMBIG_CUR]) 65 _p(" levels moved across expansion spans -- the aggregate ledger cannot say who earned them\n" as *u8) 66 _p(" decomposable " as *u8); _fn(1, out[TRO_DECOMP_PERMIL]); _p(" permil of observed movement attributed exactly\n\n" as *u8) 67 68 let f: i64 = tr_finding(out) 69 _p("NX-ECOMAT-TREND finding=" as *u8); _p(tr_finding_label(f)) 70 if f == TR_FLAT { _p(" <== no domain climbed a rung while the cohort was stable; every gain in the headline numerator arrived with a NEW domain" as *u8) } 71 if f == TR_UNDECIDABLE { _p(" <== the ledger never held its domain count still, so no span is exactly attributable (fix: per-domain ledger rows)" as *u8) } 72 _p("\nNX-ECOMAT-TREND verdict=GREEN (instrument ran; `finding` above is the ecosystem's state, not the gauge's)\n" as *u8) 73 sys_exit(0) 74 return 0 75}