nx_provclass_lib.nx
buildroot/runtime/nx_provclass_lib.nx
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
imports: nx_syscalls.nx
imported by: nx_provclass_gate.nx
structs
| none |
consts
| 40 | const PC_CONF_PRIMARY: *u8 = "knowledge/asset_provenance.conf" |
| 41 | const PC_CONF_SECONDARY: *u8 = "buildroot/knowledge/asset_provenance.conf" |
| 43 | const PC_USE_UNKNOWN: i64 = 0 |
| 44 | const PC_USE_SHIPPED: i64 = 1 |
| 45 | const PC_USE_REFERENCE_ONLY: i64 = 2 |
| 47 | const PC_OK: i64 = 0 |
| 48 | const PC_ERR_UNKNOWN_CLASS: i64 = 0 - 1 |
| 49 | const PC_ERR_BELOW_KMIN: i64 = 0 - 2 |
| 50 | const PC_ERR_NO_CONF: i64 = 0 - 3 |
| 52 | const PC_MAX_CLASSES: i64 = 64 |
| 53 | const PC_TAG_BYTES: i64 = 64 |
| 54 | const PC_TAB_BYTES: i64 = 4096 |
| 55 | const PC_IDX_BYTES: i64 = 512 |
| 56 | const PC_CH_SP: i64 = 32 |
| 57 | const PC_CH_TAB: i64 = 9 |
| 58 | const PC_CH_NL: i64 = 10 |
| 59 | const PC_CH_CR: i64 = 13 |
| 60 | const PC_CH_SEMI: i64 = 59 |
| 61 | const PC_D0: i64 = 48 |
| 62 | const PC_D9: i64 = 57 |
functions
| 71 | func pc_is_space(c: i64) -> i64 |
| 77 | func pc_streq(a: *u8, b: *u8) -> i64 called by 1: pc_find |
| 87 | func pc_eol(buf: *u8, n: i64, from: i64) -> i64 called by 1: pc_parse |
| 96 | func pc_skip_sp(buf: *u8, end: i64, from: i64) -> i64 |
| 105 | func pc_tok_end(buf: *u8, end: i64, from: i64) -> i64 |
| 116 | func pc_tok_is(buf: *u8, s: i64, e: i64, lit: *u8) -> i64 called by 1: pc_parse |
| 127 | func pc_tok_num(buf: *u8, s: i64, e: i64) -> i64 called by 1: pc_parse |
| 143 | func pc_conf_which() -> i64 { return pc_which_g } called by 1: main |
| 144 | func pc_count() -> i64 { return pc_n_g } called by 1: main |
| 146 | func pc_parse(buf: *u8, n: i64) -> i64 |
| 190 | func pc_load() -> i64 |
| 215 | func pc_find(tag: *u8) -> i64 |
| 225 | func pc_kmin(tag: *u8) -> i64 |
| 231 | func pc_use(tag: *u8) -> i64 |
| 237 | func pc_admit(tag: *u8, n: i64) -> i64 |
| 248 | func pc_may_fit_axis(tag: *u8) -> i64 |