code wiki / (root) / nx_provclass_lib.nx

nx_provclass_lib.nx

buildroot/runtime/nx_provclass_lib.nx

9251 B251 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_provclass_lib.nx -- THE PROVENANCE-CLASS RULER. One classifier, read by every organ that admits a measured fact, so a class can never mean one thing to the writer and another to the reader. WHAT IT ADDS TO nx_refcorpus, AND WHAT IT DELIBERATELY DOES NOT TOUCH. rc_admit already walls off asset PAYLOAD (length + plain alphabet) and enforces a global k-floor RC_KMIN=8. Both are properties of the VALUE. Neither looks at WHERE the measured assets came from: rc_put_row bounds `provenance` and `license` by LENGTH ONLY, so `unverified` and `cc0` pass identically. This lib is the missing axis, and it is STRICTLY ADDITIVE -- it can only ever REFUSE something rc_admit would have taken. It never loosens rc_admit and it is not a second copy of it. TWO REASONS THE `use` COLUMN EXISTS, and the second is the one that matters: 1. `shipped` -- provenance is verifiable, the class may inform artifacts we ship. 2. `reference-only` -- AGGREGATE STATISTICS ONLY. Never a shape target, never a fitted generator axis, never resolved from a build closure. Keeping an asset out of the build path stops us shipping its BYTES. It does not stop its IDENTITY propagating through a generator fitted to it -- and that output IS shipped. The build-path rule is structurally blind to that path; `reference-only` is what makes it enforceable rather than promised. FAIL CLOSED, IN BOTH DIRECTIONS THAT MATTER: * an UNKNOWN tag refuses. It does not fall through to the permissive value. The estate has already measured that cost: pr_mode returned BUFFERED for any unrecognised token, silently downgrading a fail-closed route to an open one with no diagnostic. * an UNREADABLE conf refuses too, with its own named code. A classifier that cannot read its table must ABSTAIN, never acquit -- an admission wall that opens when its rules go missing is worse than no wall, because its existence is counted as coverage. TWO-ROOT PROBE, ON PURPOSE. `knowledge/...` is a CWD-RELATIVE EXPRESSION and this estate has already paid for that: the same literal names a different tree depending on the forking process's CWD. pc_load probes the bare path FIRST, then the buildroot twin, and RECORDS WHICH ONE RESOLVED (pc_conf_which) -- a resolver that returns bytes without saying where they came from reproduces the original defect one layer up. NO LOOP-EXIT SENTINELS. The scanners below return early from helpers instead of writing a sentinel into the cursor. The estate has recorded that defect four times in one day ("a loop-exit sentinel written into the search cursor erases the answer"), and the first draft of THIS file committed it. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_provclass_lib.nx nx_provclass_gate.nx

imports: nx_syscalls.nx

imported by: nx_provclass_gate.nx

structs

none

consts

40const PC_CONF_PRIMARY: *u8 = "knowledge/asset_provenance.conf"
41const PC_CONF_SECONDARY: *u8 = "buildroot/knowledge/asset_provenance.conf"
43const PC_USE_UNKNOWN: i64 = 0
44const PC_USE_SHIPPED: i64 = 1
45const PC_USE_REFERENCE_ONLY: i64 = 2
47const PC_OK: i64 = 0
48const PC_ERR_UNKNOWN_CLASS: i64 = 0 - 1
49const PC_ERR_BELOW_KMIN: i64 = 0 - 2
50const PC_ERR_NO_CONF: i64 = 0 - 3
52const PC_MAX_CLASSES: i64 = 64
53const PC_TAG_BYTES: i64 = 64
54const PC_TAB_BYTES: i64 = 4096
55const PC_IDX_BYTES: i64 = 512
56const PC_CH_SP: i64 = 32
57const PC_CH_TAB: i64 = 9
58const PC_CH_NL: i64 = 10
59const PC_CH_CR: i64 = 13
60const PC_CH_SEMI: i64 = 59
61const PC_D0: i64 = 48
62const PC_D9: i64 = 57

functions

71func pc_is_space(c: i64) -> i64
77func pc_streq(a: *u8, b: *u8) -> i64
called by 1: pc_find
87func pc_eol(buf: *u8, n: i64, from: i64) -> i64
called by 1: pc_parse
96func pc_skip_sp(buf: *u8, end: i64, from: i64) -> i64
called by 1: pc_parse calls 1: pc_is_space
105func pc_tok_end(buf: *u8, end: i64, from: i64) -> i64
called by 1: pc_parse calls 1: pc_is_space
116func pc_tok_is(buf: *u8, s: i64, e: i64, lit: *u8) -> i64
called by 1: pc_parse
127func pc_tok_num(buf: *u8, s: i64, e: i64) -> i64
called by 1: pc_parse
143func pc_conf_which() -> i64 { return pc_which_g }
called by 1: main
144func pc_count() -> i64 { return pc_n_g }
called by 1: main
146func pc_parse(buf: *u8, n: i64) -> i64
190func pc_load() -> i64
215func pc_find(tag: *u8) -> i64
225func pc_kmin(tag: *u8) -> i64
called by 1: main calls 1: pc_find
231func pc_use(tag: *u8) -> i64
called by 1: pc_may_fit_axis calls 1: pc_find
237func pc_admit(tag: *u8, n: i64) -> i64
called by 1: main calls 1: pc_find
248func pc_may_fit_axis(tag: *u8) -> i64
called by 1: main calls 1: pc_use