code wiki / (root) / nx_comparetree_lib.nx

nx_comparetree_lib.nx

buildroot/runtime/nx_comparetree_lib.nx

15857 B261 linesdepth 2pulls 2 transitivereach 145 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_comparetree_lib.nx -- THE ONE RESOLVER FOR A /compare DATA FILE THAT LIVES IN TWO TREES. WHY THIS EXISTS (measured 2026-08-25). The estate keeps compare data in TWO forked trees: knowledge/compare/ 45 matrices buildroot/knowledge/compare/ 85 matrices (a strict SUPERSET -- all 45 names appear here) Every reader that hard-codes ONE of them is blind to whatever the other holds, and the blindness is silent: the reader reports a property OF THE DOMAIN when the true statement is about ITS OWN PATH. MEASURED COST, THE CASE THAT PRODUCED THIS LIB: nx_swcompare_evidence -- the referee that judges every domain's honesty -- built its matrix path from a single hard-coded "knowledge/compare/" prefix. For the 40 buildroot-only domains it printed EVIDENCE: matrix file missing -- fail loud / present_axes=0 grounded=0 ungrounded=0 / verdict=RED having examined NOT ONE ROW. A CONTROL PAIR settled that the cause was the tree and not the domain: typography (present in BOTH trees) graded MEASURED-HONEST 9/9, while procgen and dcc (buildroot-only) returned the identical matrix-file-missing RED from the same binary minutes apart. THIS IS THE THIRD INSTANCE OF ONE ROOT CAUSE IN A SINGLE DAY: nx_domain_admit's C3 read one tree, its C4 rebuilt the gates path a second time, and then ev_scan. A two-tree estate needs a two-tree resolver in EVERY reader, and each reader that lacks one fails silently -- flatteringly or alarmingly, never visibly. So the resolution lives HERE, once, instead of being re-derived a fourth time. ORDER -- SETTLED PER CLASS ON 2026-09-01, AND THERE IS NO LONGER ONE ORDER. .matrix resolves PUBLISHED-first (buildroot) and .gates resolves AUTHORED-first (knowledge). The census behind that split, and the reason a BLANKET flip would have been wrong in half the estate, are in the adjudication block above ct_first_published(). This header now records only the standing fact both orders rest on, and the caveat that turned out to decide the matter: THE TWO TREES ARE NOT COPIES. Sampled with nx_filehash cmp, every shared domain DIFFERS, and the buildroot copy is the larger one every time: typography 3632 vs 3805 . warden 5570 vs 6095 . mangagen 7096 vs 7125 (identical:0, all three) buildroot/knowledge/compare/ is the tree nx_compare_regen publishes from and the tree the ranker and nx_gateadjudicate read (GA_CMP2), and nx_domain_admit's gate asserts it by name as "the publishing tree". PRIMARY-first preserved every existing verdict at the price of grading a file the published page does not render, on 45 boards. The prior text called that "a SECOND, SEPARATE defect ... named here rather than silently decided" -- THIS CHANGE IS THAT DECISION, and the verdicts it moves are re-censused and published with it rather than left to be discovered by whoever reads a board next. EVERY ORDER IS PINNED BY GATE TEETH IN BOTH POSITIONS (first AND fallback), so the NEXT flip is also an adjudication and not a tweak -- which is the property the original author built this file to have.

dependencies 1 imports · 22 importers

nx_syscalls.nx nx_comparetree_lib.nx nx_barfresh_lib.nx nx_board_contract_gate.nx nx_compare_cite.nx nx_compare_growth_matrix_full_2026 nx_compare_shared_fit_matrix_20260 nx_comparetree_lib_gate.nx nx_compile_field_candidate_t280.nx nx_compile_x86.nx nx_ecomat_lib.nx nx_frontier_scan.nx

diagram shows first 10 each side; +0 more imports, +12 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_barfresh_lib.nxnx_board_contract_gate.nxnx_compare_cite.nxnx_compare_growth_matrix_full_20260910.nxnx_compare_shared_fit_matrix_20260910.nxnx_comparetree_lib_gate.nxnx_compile_field_candidate_t280.nxnx_compile_x86.nxnx_ecomat_lib.nxnx_frontier_scan.nxnx_frontier_scan_review_candidate_t346.nxnx_sota_status.nxnx_swcompare_evidence.nxnx_swcompare_evidence_gate.nxnx_swcompare_evidence_matrix_t138.nxnx_swcompare_heading_matrix_20260907.nxnx_swcompare_matrix.nxnx_swcompare_matrix_ladder_test_20260907.nxnx_swcompare_matrix_rank_guard_t162.nxnx_swcompare_preview_matrix_t56.nxnx_swcompare_production_matrix_20260907.nxnx_workmix.nx

structs

none

consts

47const CT_PATH_CAP: i64 = 512
51const CT_DIR_PRIMARY: *u8 = "knowledge/compare/"
52const CT_DIR_SECONDARY: *u8 = "buildroot/knowledge/compare/"
56const CT_TREE_NONE: i64 = 0
57const CT_TREE_PRIMARY: i64 = 1
58const CT_TREE_SECONDARY: i64 = 2

functions

63func ct_cat(dst: *u8, off: i64, s: *u8) -> i64
called by 2: ct_build_pathmain
72func ct_build_path(dir: *u8, dom: *u8, suf: *u8, dst: *u8) -> i64
83func ct_pick(n1: i64, n2: i64) -> i64
89func ct_read(path: *u8, buf: *u8, cap: i64) -> i64
106func ct_read_2dir(d1: *u8, d2: *u8, dom: *u8, suf: *u8, buf: *u8, cap: i64, which: *i64) -> i64
155func ct_first_published() -> *u8
158func ct_second_published() -> *u8
161func ct_first_authored() -> *u8
164func ct_second_authored() -> *u8
183func ct_swap_tree(t: i64) -> i64
189func ct_compare_read_published(dom: *u8, suf: *u8, buf: *u8, cap: i64, which: *i64) -> i64
196func ct_compare_read_authored(dom: *u8, suf: *u8, buf: *u8, cap: i64, which: *i64) -> i64
227func ct_readall_2dir(d1: *u8, d2: *u8, dom: *u8, suf: *u8, outn: *i64, which: *i64) -> *u8
257func ct_compare_readall_published(dom: *u8, suf: *u8, outn: *i64, which: *i64) -> *u8