code wiki / (root) / nx_leaderboard_lib.nx

nx_leaderboard_lib.nx

buildroot/runtime/nx_leaderboard_lib.nx

14007 B312 linesdepth 2pulls 2 transitivereach 36 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_leaderboard_lib.nx -- THE ONE reader of <dom>.leaderboard (ecosystem EC44, 2026-09-15): leaderboard rows AS DATA, read from mirrored bytes, with the estate's own row placed by arithmetic, never by hand. WHY. The operator's goal names a public leaderboard (BRIGHT) as the evidence surface, and the estate's measuring organ (nx_beir_eval be_bright) already writes the estate's row into knowledge/compare/<dom>.leaderboard -- but no compare page rendered the file, so the number lived in a file nobody published. A LEADERBOARD THE BOARD DOES NOT RENDER IS A CLAIM THE BOARD CANNOT MAKE. This lib is the ruler the emitter's lb_pass projects: head|<board>|<source url>|<mirror>|<pin>|<fetched YYYY-MM-DD>|<metric> lb|<board>|<rank>|<system>|<org>|<score>|<date>|<entry url> A score is decimal with at most one fractional digit (the published boards print nDCG x 100 to one decimal); it is held as score x10 so 66.9 and 14.5 compare as integers. The ESTATE's rows are the ones whose system starts with LB_ESTATE_PREFIX; every other row is a published rival. The estate's RANK is 1 + the number of rival rows whose score is strictly higher (a tie ranks with the tied); its GAP is the leader's score minus its own; its LEAPS are the score deltas between its own rows in date order (the harness appends one row per measurement, dated). license_tier: ORIGINAL. No hw writes (Rule 26).

dependencies 1 imports · 5 importers

nx_syscalls.nx nx_leaderboard_lib.nx nx_lbclimb.nx nx_lbclimb_gate.nx nx_lbclimb_lib.nx nx_leaderboard_gate.nx nx_swcompare_lib.nx

imports: nx_syscalls.nx

imported by: nx_lbclimb.nxnx_lbclimb_gate.nxnx_lbclimb_lib.nxnx_leaderboard_gate.nxnx_swcompare_lib.nx

structs

none

consts

18const LB_DIR: *u8 = "knowledge/compare/"
19const LB_EXT: *u8 = ".leaderboard"
20const LB_PATH_CAP: i64 = 600
21const LB_I64_BYTES: i64 = 8
22const LB_TAG_HEAD: *u8 = "head"
23const LB_TAG_ROW: *u8 = "lb"
24const LB_KIND_OTHER: i64 = 0
25const LB_KIND_HEAD: i64 = 1
26const LB_KIND_ROW: i64 = 2
27const LB_F_TAG: i64 = 0
28const LB_F_BOARD: i64 = 1
29const LB_H_URL: i64 = 2
30const LB_H_MIRROR: i64 = 3
31const LB_H_PIN: i64 = 4
32const LB_H_FETCHED: i64 = 5
33const LB_H_METRIC: i64 = 6
34const LB_H_NF: i64 = 7
35const LB_R_RANK: i64 = 2
36const LB_R_SYSTEM: i64 = 3
37const LB_R_ORG: i64 = 4
38const LB_R_SCORE: i64 = 5
39const LB_R_DATE: i64 = 6
40const LB_R_URL: i64 = 7
41const LB_R_NF: i64 = 8
42const LB_ESTATE_PREFIX: *u8 = "nishi"
43const LB_SCORE_SCALE: i64 = 10 // scores held as x10: one fractional digit
44const LB_CH_PIPE: i64 = 124
45const LB_CH_LF: i64 = 10
46const LB_CH_CR: i64 = 13
47const LB_CH_HASH: i64 = 35
48const LB_CH_DOT: i64 = 46
49const LB_CH_ZERO: i64 = 48
50const LB_CH_NINE: i64 = 57
51const LB_TEN: i64 = 10
52const LB_NONE: i64 = 0 - 1

functions

54func lb_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: lb_eq_nlb_prefix_n
55func lb_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o + i] = s[i]; i = i + 1 } return o + i }
called by 1: lb_path
56func lb_path(dir: *u8, dom: *u8, out: *u8) -> i64
calls 1: lb_cat
64func lb_field(line: *u8, n: i64, k: i64, off: *i64, len: *i64) -> i64
84func lb_eq_n(a: *u8, s: *u8, n: i64) -> i64
called by 2: lb_row_kindlb_boards calls 1: lb_slen
90func lb_prefix_n(pfx: *u8, s: *u8, n: i64) -> i64
called by 1: lb_row_is_estate calls 1: lb_slen
98func lb_nfields(line: *u8, n: i64) -> i64
called by 1: lb_row_kind
105func lb_row_kind(line: *u8, n: i64, board: *u8) -> i64
126func lb_score_x10(s: *u8, n: i64) -> i64
151func lb_row_score(line: *u8, n: i64) -> i64
157func lb_row_is_estate(line: *u8, n: i64) -> i64
164func lb_line(buf: *u8, n: i64, from: i64, off: *i64, len: *i64) -> i64
174func lb_count(buf: *u8, n: i64, board: *u8, out_heads: *i64, out_rivals: *i64, out_estate: *i64) -> i64
195func lb_leader(buf: *u8, n: i64, board: *u8) -> i64
212func lb_rank_of(buf: *u8, n: i64, board: *u8, score_x10: i64) -> i64
230func lb_estate_latest(buf: *u8, n: i64, board: *u8, roff: *i64, rlen: *i64) -> i64
254func lb_date_ge(a: *u8, an: i64, b: *u8, bn: i64) -> i64
261func lb_estate_leap(buf: *u8, n: i64, board: *u8) -> i64
291func lb_boards(buf: *u8, n: i64, boff: *i64, blen: *i64, cap: i64) -> i64