code wiki / (root) / nx_debt_recurrence_lib.nx

nx_debt_recurrence_lib.nx

buildroot/runtime/nx_debt_recurrence_lib.nx

15123 B261 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind librarytopic debt
docsdependenciesstructsconstsfunctions

about

nx_debt_recurrence_lib.nx -- CE3 (codeeffectiveness ce_recurrence): RECURRENCE PER DEFECT CLASS over the debt plane. Resolution effectiveness is not a close count: the estate's own record has one defect filed five times in three weeks. This is the ONE ruler for that class, composed by nx_debtmine (the incumbent bugs-class miner, which already held per-scope eat-rate and aging) and driven in-process by its gate. Over the plane rows (id TAB sev TAB scope TAB status TAB desc) it interns scopes and, per scope, records the FIRST EATEN filing as the prior and counts every row filed AFTER it as a recurrence of the class: recur_total (history, non-decreasing by construction) and recur_open (the live re-filings, which FALL when they are eaten). The ids are named -- the prior id and a bounded prefix of the recurring ids beside their total -- because a bare number is not the measure the rung asked for. CLOSE TIME IS UNRECORDED ON THIS PLANE (ids are file-time), so a row filed after a prior that was eaten later still counts: the count is an UPPER BOUND and says so in the document. A run with no rows writes no spine row; the spine path is derived from the source (the production spine iff the source is the live plane, else a <source>.recurrence.spine sidecar), so a fixture can never forge the production trajectory. The scope table has NO PICKED BOUND: its capacity is drc_capacity(q, n), derived from the rows, so scopes_capped is 0 by construction and stays in the document as an invariant the gate asserts (the first live beat, 2026-09-06, hit a 256-slot bound on a 4,353-row plane and published a floor wearing a total). Ids are epoch-seconds, so an autofile burst shares one id across several rows: those are distinct filings and count as such, and the adjacent-burst count is published beside the ids (adjacent only, a declared floor) so a reader knows why an id can repeat. The row walk mirrors nx_debtmine's inline loop (sj_le / sj_col / comment skip); extraction of that walk into a shared reader is the declared follow-up, not a second parser by intent. license_tier: ORIGINAL No hw writes.

dependencies 2 imports · 2 importers

nx_sovjson_lib.nx nx_syscalls.nx nx_debt_recurrence_lib.nx nx_debt_recurrence_gate.nx nx_debtmine.nx

imports: nx_sovjson_lib.nxnx_syscalls.nx

imported by: nx_debt_recurrence_gate.nxnx_debtmine.nx

structs

none

consts

26const DRC_IDS_PER_SCOPE: i64 = 8 // the PRINTED prefix of recurring ids; the count beside it is the total
27const DRC_WORD: i64 = 8
28const DRC_LINE: i64 = 512
29const DRC_PATH: i64 = 1024
30const DRC_MODE644: i64 = 420
31const DRC_NL: i64 = 10
32const DRC_COMMENT: i64 = 35
33const DRC_QUOTE: i64 = 34
34const DRC_COLON: i64 = 58
35const DRC_COMMA: i64 = 44
36const DRC_LBRACE: i64 = 123
37const DRC_RBRACE: i64 = 125
38const DRC_LBRACK: i64 = 91
39const DRC_RBRACK: i64 = 93
40const DRC_NAME_MAX: i64 = 120
41const DRC_PROD_PREFIX: *u8 = "knowledge/store/debt-"
42const DRC_SPINE_PROD: *u8 = "knowledge/status/debt_recurrence.spine"
43const DRC_SPINE_SIDECAR: *u8 = ".recurrence.spine"
44const DRC_COL_ID: i64 = 0
45const DRC_COL_SCOPE: i64 = 2
46const DRC_COL_STATUS: i64 = 3
48const DRC_S_OFF: i64 = 0
49const DRC_S_LEN: i64 = 1
50const DRC_S_FILED: i64 = 2
51const DRC_S_EATEN: i64 = 3
52const DRC_S_PRIOR: i64 = 4
53const DRC_S_RTOTAL: i64 = 5
54const DRC_S_ROPEN: i64 = 6
55const DRC_S_NIDS: i64 = 7
56const DRC_S_SLOTS: i64 = 8
58const DRC_R_ROWS: i64 = 0
59const DRC_R_SCOPES: i64 = 1
60const DRC_R_SCOPES_RECUR: i64 = 2
61const DRC_R_ROPEN: i64 = 3
62const DRC_R_RTOTAL: i64 = 4
63const DRC_R_CAPPED: i64 = 5
64const DRC_R_MALFORMED: i64 = 6
65const DRC_R_IDBURST: i64 = 7 // rows whose id equals the previous row's id (an autofile burst shares an epoch-second): adjacent only, a declared floor
66const DRC_R_SLOTS: i64 = 8

functions

68func drc_key(d: *u8, o: i64, name: *u8) -> i64 { d[o] = DRC_QUOTE as u8; var p: i64 = sj_cat(d, o + 1, name); d[p] = DRC_QUOTE as u8; d[p + 1] = DRC_COLON as u8; return p + 2 }
called by 2: drc_emit_jsondrc_spine_json calls 1: sj_cat
69func drc_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] == b[i] { if a[i] == (0 as u8) { return 1 } i = i + 1 } return 0 }
called by 1: drc_spine_path
70func drc_str(d: *u8, o: i64, s: *u8) -> i64 { d[o] = DRC_QUOTE as u8; var p: i64 = sj_cat(d, o + 1, s); d[p] = DRC_QUOTE as u8; return p + 1 }
called by 2: drc_emit_jsondrc_spine_json calls 1: sj_cat
76func drc_capacity(q: *u8, n: i64) -> i64
83func drc_scan(q: *u8, n: i64, cap: i64, st: *i64, ids: *i64, r: *i64) -> i64
157func drc_emit_json(d: *u8, p0: i64, q: *u8, st: *i64, ids: *i64, nsc: i64, r: *i64, topn: i64) -> i64
226func drc_spine_path(src: *u8, out: *u8) -> i64
called by 1: drc_spine_json calls 2: drc_streqsj_cat
232func drc_spine_json(d: *u8, p0: i64, src: *u8, now: i64, r: *i64) -> i64