code wiki / (root) / nx_compare_rank_refresh_test_20260907.nx

nx_compare_rank_refresh_test_20260907.nx

buildroot/runtime/nx_compare_rank_refresh_test_20260907.nx

85097 B1257 linesdepth 6pulls 16 transitivereach 0 importersview sourcekind tooltopic compare
docsdependenciesstructsconstsfunctions

about

nx_compare_rank.nx -- THE ROADMAP RANKER: priority computed from the boards, never chosen by a seat. Operator 2026-08-18: "we need sota best of breed prioritization and ranking from the foundation first bit up in our compares to drive our roadmaps ... it needs to push back on your random doing of low priorities" and "we cant keep having you do random shit and say its effective". A seat picking rungs by whatever is cheapest with parts in-tree is the defect; this organ makes the compare COMPUTE the order from data the boards already carry and PUBLISH it where every seat, MCP caller and RACI row reads it. It decides nothing itself: the math is nx_dr_ocm (DR-6 opportunity-cost ranker, Priority=(V*M)/C, integer deterministic -- REGISTERED-DARK until today, adopted here) and the plane write is nx_store_put; this organ only DERIVES the three inputs per open rung, all from data: THE MATHEMATICS (v5, 2026-08-18 -- operator: "a full mathematical system on opportunity cost, clustering, foundation-up capabilities, best-of-breed research as of August 2026", not a seat's coefficients). Every term is COUNTED or a RATIO of board data; the only chosen constant left is RANK_COST_UNKNOWN and it fires only on a plan row that declared no cost (a labeled data defect). value v = deficit + CoD + option + enables (all from matrix codes + dep rows) deficit = sum of rival codes on the rung's row (2 leads, 1 present, 0 absent): value at stake CoD = deficit x (rivals LEADING / rivals total): WSJF cost-of-delay -- the fraction of the field already ahead is the time-criticality; every unit open, that many rivals widen it option = 1, ONLY when every rival is absent: the lead itself, held by nobody -- its unlocking value is already the enables leg below (one leg each; a v5 draft double-charged it) enables = number of OTHER open rungs whose transitive dependency closure contains this rung: the foundation-first / opportunity-enablement leg (WSJF) and the compound-option leg (real-options portfolio theory), counted from dep rows momentum m = 1 + declared dependencies already MEASURED present (substrate landed; never 0 because nx_dr_ocm multiplies and a zero would hide the rung) cost c = the plan's own est u in tenths, DIVIDED by the rung's cluster size (open rungs sharing the same organ file share substrate: read once, one build lane, one gate to extend -- graph clustering on the organ column, measured never labelled); unestimated -> labeled sponsor = the operator's sponsor- plane coefficient (PR6), applied to value, every firing row named priority = nx_dr_ocm( v x sponsor, m, c ) = (V x M x 1000)/C with forgone-best-alternative and budget-aware greedy selection (DR-6, integer deterministic) critical path: the FIRST unmet product version's milestone rungs + transitive open deps rank before everything else (ver| rows) -- staged delivery 0.1 -> 1.0 -> 2.0. Provenance: WSJF/cost-of-delay (SAFe LPM), real-options R&D portfolio valuation with project interdependencies (Blau et al.; OptFolio-class DSS), integer-programming portfolio selection under budget (knapsack form -- dr_ocm's greedy is the bounded-effort stand-in), dependency-graph enablement. pmdash.refs carries the citations. What is NOT here, honestly: uncertainty distributions (PTRS-style success probabilities per rung) -- the estate has no measured per-rung success rate yet; PR7's actuals-write-back is the data that makes that term possible, and it will be added when the data

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_tool_run.nx nx_rank_refresh_lib.nx nx_catalog_lib.nx nx_symdecl_lib.nx nx_barfresh_lib.nx nx_ladder_lib.nx nx_compare_rank_refresh_test_2

imports: nx_syscalls.nxnx_tool_run.nxnx_rank_refresh_lib.nxnx_catalog_lib.nxnx_symdecl_lib.nxnx_barfresh_lib.nxnx_ladder_lib.nx

imported by: nobody (leaf or entry point)

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

main rk_puts sys_write rk_slen rk_streq rk_int rk_slen ↻ sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ rk_cat rk_read_all sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close rrf_hash sys_mmap ↻ sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_seed_allocated sha256_k

structs

none

consts

65const RANK_EXIT_REFRESH_IO: i64 = 7
66const RANK_EXIT_DISPATCH: i64 = 8
67const RANK_INPUT_METADATA_BYTES: i64 = 256 // two SHA256 hex strings, sizes and labels
68const RANK_EXIT_BAR_STALE: i64 = 5 // a declared bar older than the current month with no this-month attestation: the board hands out no work
69const RANK_EXIT_LADDER_PARTIAL: i64 = 6 // a declared ladder to SOTA left half-declared (an undated target, a rung with no role): refused the same way
80const RK_DEC_MAX: i64 = 20 // max decimal digits of an i64 (19) plus a sign: the width of one
82const RK_NUMBUF: i64 = RK_DEC_MAX + 4 // one number rendered to text + NUL + slack for the '-' and terminator
85const RANK_COST_UNKNOWN: i64 = 100 // 10.0 u: an unestimated rung is treated as EXPENSIVE, labeled --
88const RANK_DEFAULT_BUDGET: i64 = 300 // 30.0 u -- above every plan's full-parity figure, so the greedy
91const RANK_STORE_FIELDS: i64 = 8
100const RK_NOTE_LITERALS: i64 = 531
101const RK_NOTE_NUMS: i64 = 13
102const RK_SPONSOR_ROW_LITERALS: i64 = 11
103const RANK_FORK_CAP: i64 = 4096 // captured stdout of one nx_store_put / nx_pm_intake fork: their
109const RK_OCM_OBJ_BYTES: i64 = 89 + 8 * RK_DEC_MAX
110const RK_OCM_HDR_BYTES: i64 = 195 + 5 * RK_DEC_MAX + 16
117const RANK_FIX_PER_RUNG: i64 = 64 + 10 * RK_DEC_MAX // row skeleton: kind, pipes, numbers, newline
122const RANK_UNMAPPED_ROW: i64 = 48
126const RANK_FIX_TAIL: i64 = 512 // the stamped last line + the unmapped count line
127const RANK_PM_TOP: i64 = 3 // critical rungs filed into pm intake per run: enough to drive
258const SPONSOR_BASE: i64 = 4 // plus2 = +50%, plus1 = +25%, minus1 = -25%, minus2 = -50%
259const SPONSOR_PLANE_CAP: i64 = 262144
358const SELFSUFF_BASE: i64 = 4
359const SELFSUFF_FLOOR: i64 = 1
360const SELFSUFF_PEN_CAP: i64 = SELFSUFF_BASE - SELFSUFF_FLOOR

functions

130func rk_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
131func rk_puts(s: *u8) -> i64 { sys_write(1, s, rk_slen(s)); return 0 }
132func rk_pn(v: i64) -> i64
144func rk_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var oo: i64 = o; while s[i] != (0 as u8) { d[oo] = s[i]; oo = oo + 1; i = i + 1 } d[oo] = 0 as u8; return oo }
145func rk_catn(d: *u8, o: i64, v: i64) -> i64
155func rk_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] == b[i] { if a[i] == (0 as u8) { return 1 } i = i + 1 } return 0 }
156func rk_starts(s: *u8, p: *u8) -> i64 { var i: i64 = 0; while p[i] != (0 as u8) { if s[i] != p[i] { return 0 } i = i + 1 } return 1 }
161func rk_read_all(path: *u8, outb: *i64) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
169func rk_lines(b: *u8, n: i64) -> i64
called by 1: main
176func rk_max_pipes(b: *u8, n: i64) -> i64
called by 1: main
188func rk_split(s: *u8, fld: *i64, maxf: i64) -> i64
called by 1: main
194func rk_tenths(s: *u8) -> i64
called by 1: main
208func rk_int(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v }
called by 1: main
210func rk_sym_is(rowsym: *u8, sym: *u8) -> i64
called by 1: main calls 2: rk_streqrk_starts
221func rk_measure(org: *u8, sym: *u8) -> i64
238func rk_dark(org: *u8, sym: *u8) -> i64
260func rk_has(hay: *u8, needle: *u8) -> i64
called by 1: rk_sponsor_term calls 1: rk_slen
273func rk_sponsor_term(plane: *u8, plen: i64, dom: *u8, rid1: *u8, sym: *u8, nb: *u8, no0: i64, noOut: *i64) -> i64
365func rk_ss_eqf(b: *u8, s: i64, e: i64, lit: *u8) -> i64
called by 1: rk_selfsuff_term
377func rk_ss_atoi(b: *u8, s: i64, e: i64) -> i64
called by 1: rk_selfsuff_term
392func rk_selfsuff_term(led: *u8, ln: i64, dom: *u8, org: *u8, nb: *u8, no0: i64, noOut: *i64) -> i64
448func rk_list_one(idstr: *u8, mode: i64, rid: *i64, nr: i64, rdone: *i64, crit: *i64) -> i64
called by 1: rk_list_scan calls 1: rk_streq
462func rk_list_scan(ls: *u8, mode: i64, rid: *i64, nr: i64, rdone: *i64, crit: *i64) -> i64
called by 1: main calls 3: sys_mmaprk_slenrk_list_one
483func rk_write_rank_unlocked(dom: *u8, buf: *u8, n0: i64, nr: i64, ndone: i64, nopen: i64, nfinish: i64, tgt: i64, vlab: *i64) -> i64
522func rk_write_rank(dom: *u8, buf: *u8, n0: i64, nr: i64, ndone: i64, nopen: i64, nfinish: i64, tgt: i64, vlab: *i64) -> i64
535func qcap_stage_max(vlab: *i64, nver: i64) -> i64
called by 1: main calls 1: rk_slen
542func main(argc: i64, argv: *i64) -> i64