code wiki / (root) / nx_catalog_lib.nx

nx_catalog_lib.nx

buildroot/runtime/nx_catalog_lib.nx

51277 B1006 linesdepth 3pulls 4 transitivereach 28 importersview sourcekind librarytopic catalog
docsdependenciesstructsconstsfunctions

about

nx_catalog_lib.nx -- THE ONE ADOPTION-LADDER CLASSIFIER, extracted from nx_catalog (2026-08-23, compare CE2). WHY A LIB: nx_catalog computed the estate's DEFINITION OF DONE -- the seven-rung ladder SOURCE BUILT STAGED PROMOTED REGISTERED AUTHORISED INVOKED and its weakest-link verdict -- inside a print-interleaved cat_one(), so the answer could only be read by a human off stdout. The /compare generator and the roadmap ranker both needed the same answer PER BOARD ROW, and "done" there was rung ONE of seven (a `func <sym>` line exists in a source file) -- which is exactly why a partial deploy was invisible on every board: a gate compiled and never promoted, an organ promoted and never registered, read identically to LIVE. WHEN TWO ORGANS MUST AGREE, MAKE DISAGREEMENT IMPOSSIBLE BY CONSTRUCTION: one classifier here, imported by nx_catalog (prints it), nx_swcompare_matrix (renders it per row) and nx_compare_rank (ranks on it). The The classifier preserves the original ladder codes; coverage-aware journal evidence and scoped wording were added in September 2026. LIVE denotes wiring, not capability quality. cl_ladder(name, registry, consent, actlog, m) -> verdict code (CLV_*); m[CLM_*] carries every measured stage, so a caller prints or renders WHAT WAS MEASURED, never only the verdict (a verdict is not a diagnosis). cl_gap(code) = 1 when the verdict is an adoption gap; LIB and LIVE-DAEMON are NOT gaps (a binary is impossible for one and registration is wrong for the other -- see nx_catalog's header). cl_verdict_name(code) is the short token boards print; cl_verdict_text(code) is the exact sentence nx_catalog has always printed. license_tier: ORIGINAL Read-only. No hw writes (Rule 26).

dependencies 3 imports · 22 importers

nx_syscalls.nx nx_organkind.nx nx_estate_path.nx nx_catalog_lib.nx nx_catalog.nx nx_catalog_adopt_t75.nx nx_catalog_call_gate_20260909.nx nx_catalog_coverage_adopt_t75.nx nx_catalog_dispatch_t66.nx nx_compare_growth_matrix_full_2026 nx_compare_rank.nx nx_compare_rank_artifact_20260910. nx_compare_rank_refresh_test_20260 nx_compare_regen.nx

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

imports: nx_syscalls.nxnx_organkind.nxnx_estate_path.nx

imported by: nx_catalog.nxnx_catalog_adopt_t75.nxnx_catalog_call_gate_20260909.nxnx_catalog_coverage_adopt_t75.nxnx_catalog_dispatch_t66.nxnx_compare_growth_matrix_full_20260910.nxnx_compare_rank.nxnx_compare_rank_artifact_20260910.nxnx_compare_rank_refresh_test_20260907.nxnx_compare_regen.nxnx_compare_regen_scoped.nxnx_compare_regen_t138.nxnx_compare_shared_fit_matrix_20260910.nxnx_domain_admit.nxnx_libindex_lib.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.nx

structs

none

consts

29const CL_BUF: i64 = 4194304 // registry/consent/actlog read cap; the actlog read is TAIL-anchored (cl_slurp_tail)
30const CL_PATH: i64 = 1024
31const CL_SEEK_SET: i64 = 0
32const CL_SEEK_END: i64 = 2
34const CLM_SRC: i64 = 0 // source bytes, or -1 when no root resolves it
35const CLM_LIB: i64 = 1 // 1 = no top-level main() (a binary is not expected), 0 = program, -1 = unreadable
36const CLM_BUILT: i64 = 2 // buildroot/_build/<n>.sov.elf bytes, or -1
37const CLM_STAGED: i64 = 3 // <n>.sov.elf.new bytes, or -1 (a loaded gun aimed at the next deploy)
38const CLM_PROMOTED: i64 = 4 // <n>.elf | _offc/<n>.elf bytes, or -1
39const CLM_REG: i64 = 5 // 1 = tool_allowlist.conf row "<n><TAB>"
40const CLM_AUTH: i64 = 6 // 1 = cap_consent.log mentions it
41const CLM_INV: i64 = 7 // 1 = completed MCP call matched in supplied actlog window; not lifetime or quality evidence
42const CLM_DKIND: i64 = 8 // declared kind from organ_kind.conf (OK_DAEMON or other)
43const CLM_RESOLVED: i64 = 9 // HOW field 2 of the registry row resolved: one of the CLR_* below
44const CLM_N: i64 = 10
49const CLR_NAME: i64 = 0 // no registry row at all -- the <name>.nx/<name>.elf convention answered
50const CLR_PATH: i64 = 1 // field 2 STATTED AS GIVEN -- the row is the contract and the contract holds
51const CLR_REGBASE: i64 = 2 // field 2 did NOT stat; its basename answered instead -> the row is MISPOINTED
52const CL_CH_SLASH: i64 = 47
53const CL_CH_DOT: i64 = 46
55const CLV_ABSENT: i64 = 0
56const CLV_SOURCE_ONLY: i64 = 1
57const CLV_BUILT_UNPROMOTED: i64 = 2
58const CLV_PROMOTED_SOURCELESS: i64 = 3
59const CLV_PROMOTED_UNREGISTERED: i64 = 4
60const CLV_REGISTERED_UNAUTHORISED: i64 = 5
61const CLV_REGISTERED_DARK: i64 = 6
62const CLV_LIVE: i64 = 7
63const CLV_LIB: i64 = 8
64const CLV_LIVE_DAEMON: i64 = 9
67const CLV_FIXTURE: i64 = 10
68const CLV_REGISTRY_MISPOINTED: i64 = 11
69const CLV_N: i64 = 12
184const CLC_STATE:i64=0
185const CLC_EXTENT:i64=1
186const CLC_START:i64=2
187const CLC_END:i64=3
188const CLC_READ:i64=4
189const CLC_HEAD:i64=5
190const CLC_TAIL:i64=6
191const CLC_ERRNO:i64=7
192const CLC_FINAL:i64=8
193const CLC_OBSERVED:i64=9
194const CLC_N:i64=10
195const CLC_OK:i64=0
196const CLC_OPEN:i64=1
197const CLC_SEEK:i64=2
198const CLC_ALLOC:i64=3
199const CLC_READ_ERROR:i64=4
200const CLC_CHANGED:i64=5
201const CLC_CLOSE:i64=6
202const CLC_INVALID:i64=7
740const CLB_TOK_CAP: i64 = 96
741const CLB_FULL: i64 = 1
742const CLB_PARTIAL: i64 = 0
743const CLB_NA: i64 = 2
744const CLB_TAB: i64 = 9
745const CLB_PIPE: i64 = 124
746const CLB_GA_COL_TRIAL: i64 = 17 // gateadjudicate.rows: name|src|...|ref|first_ref|trial|class
747const CLB_GA_COL_CLASS: i64 = 18
748const CLB_IMP_COL_IMPORTERS: i64 = 1 // importers.tsv: name importers importers_nonval imports first
749const CLB_IMP_COL_NONVAL: i64 = 2
751const CLB_REG: i64 = 0
752const CLB_REGN: i64 = 1
753const CLB_CNS: i64 = 2
754const CLB_CNSN: i64 = 3
755const CLB_ACT: i64 = 4
756const CLB_ACTN: i64 = 5
757const CLB_IMP: i64 = 6
758const CLB_IMPN: i64 = 7
759const CLB_GA: i64 = 8
760const CLB_GAN: i64 = 9
761const CLB_IMP_ASOF: i64 = 10
762const CLB_GA_ASOF: i64 = 11
767const CLB_ES: i64 = 12
768const CLB_ESN: i64 = 13
769const CLB_ES_ASOF: i64 = 14
770const CLB_N: i64 = 15
771const CLB_ES_COL_FIRST: i64 = 7 // execsurface.tsv: name clock cron daemon fork roster actlog first_surface
772const CLB_REM_CAP: i64 = 512 // a composed remedy: the ladder's sentence plus the surfaces checked

functions

71func cl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
80func cl_estate_path(out: *u8, p: *u8) -> *u8
85func cl_open_estate(p: *u8) -> i64
93func cl_read_whole(path: *u8, lp: *i64) -> *u8
116func cl_cat3(dst: *u8, pre: *u8, name: *u8, suf: *u8) -> i64
132func cl_fsize(path: *u8) -> i64
142func cl_has_sub(hay: *u8, hn: i64, ned: *u8) -> i64
called by 1: cl_ladder calls 1: cl_slen
161func cl_slurp(path: *u8, lp: *i64) -> *u8
203func cl_tail_state_name(s:i64)->*u8
213func cl_tail_reset(c:*i64)->i64
219func cl_slurp_tail_fd(fd:i64,cap:i64,lp:*i64,c:*i64)->*u8
266func cl_slurp_tail_covered(path:*u8,lp:*i64,c:*i64)->*u8
275func cl_slurp_tail(path:*u8,lp:*i64)->*u8
290func cl_fsize_asgiven(path: *u8) -> i64
301func cl_strip1(out: *u8, o: i64, sfx: *u8) -> i64
called by 1: cl_strip_artifact
314func cl_strip_artifact(out: *u8, o0: i64) -> i64
called by 1: cl_regresolve calls 1: cl_strip1
344func cl_regresolve(alw: *u8, alwn: i64, name: *u8, out: *u8, regp: *u8, rb: *i64, cap: i64) -> i64
397func cl_resolved_name(code: i64) -> *u8
406func cl_src(p: *u8, eff: *u8) -> i64
430func cl_is_lib(path: *u8) -> i64
466func cl_actlog_completed(act: *u8, n: i64, name: *u8) -> i64
522func cl_ladder(name: *u8, alw: *u8, alwn: i64, cns: *u8, cnsn: i64, act: *u8, actn: i64, m: *i64) -> i64
617func cl_gap(code: i64) -> i64
626func cl_verdict_name(code: i64) -> *u8
called by 1: clb_classify
643func cl_remedy(code: i64) -> *u8
called by 1: clb_classify
656func cl_verdict_text(code: i64) -> *u8
673func cl_name_of_path(path: *u8, out: *u8, cap: i64) -> i64
694func cl_symbol_declared(organ_path: *u8, sym: *u8) -> i64
774func clb_eq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 }
775func clb_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } d[p] = 0 as u8; return p }
called by 1: clb_classify
776func clb_ends(s: *u8, sfx: *u8) -> i64
called by 1: clb_classify calls 1: cl_slen
784func clb_catn(d: *u8, o: i64, v: i64) -> i64
called by 1: clb_classify calls 2: sys_mmapsys_munmap
799func clb_digits(b: *u8, i: i64, n: i64) -> i64
813func clb_row(b: *u8, n: i64, name: *u8, sep: i64) -> i64
called by 1: clb_classify calls 1: cl_slen
830func clb_field_off(b: *u8, n: i64, r: i64, f: i64, sep: i64) -> i64
841func clb_field_str(b: *u8, n: i64, r: i64, f: i64, sep: i64, out: *u8, cap: i64) -> i64
called by 1: clb_classify calls 1: clb_field_off
855func clb_field_int(b: *u8, n: i64, r: i64, f: i64, sep: i64) -> i64
861func clb_last_kv(b: *u8, n: i64, key: *u8) -> i64
called by 1: clb_load calls 2: cl_slenclb_digits
880func clb_load(ads: *i64) -> i64
904func clb_classify(name: *u8, ads: *i64, tok: *u8, rem: *i64) -> i64