code wiki / (root) / nx_communitypulse.nx

nx_communitypulse.nx

buildroot/runtime/nx_communitypulse.nx

48468 B892 linesdepth 10pulls 24 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_communitypulse.nx -- COMMUNITY PULSE: an anonymous how-are-things-going pulse for a congregation, an agency or a nonprofit (MICRO), rolled up to locality, region and nation under one k-anonymity floor with complementary suppression (MACRO), on ONE open instrument. Admitted 2026-08-24 against /compare/communitypulse. COMPOSES, never re-implements: nx_survey_engine (specs as data, anonymous ballots, latest-wins revote), nx_survey_stats (collect, isqrt, trend split, the 95pct z), nx_cell_lib (organisation and place rows), nx_kfloor_lib (the floor and the complementary rule), nx_sha256 + nx_ed25519_signature (the signed export). EVERY THRESHOLD IS A CONF ROW read line-anchored from argv[1]; a missing row REFUSES by name, never defaults. VERBS nx_communitypulse <conf> <verb> ... cell-put <prefix> <id> <kind> <name> <parent|-> <denom> cp_org_scope cell-list <prefix> instrument <prefix> <specfile> <instrument> <cell> cp_instrument (spec rows -> a survey at that cell) kiosk <prefix> <instrument> <cell> <qid=val>... cp_kiosk (token-less, per-cell rate row) rollup <prefix> <instrument> <qid> cp_rollup + cp_complement_suppress weights <prefix> <instrument> <qid> cp_weights (declared denominators, printed) page <prefix> <instrument> <qid> <cell> <out.html> cp_public_page + cp_benchmark alert <prefix> <instrument> <cell> <qid> cp_alert (count only, floor applies) export <prefix> <instrument> <qid> <out> cp_open_export (sha256 pin + ed25519 signature) verify <file> cp_verify_export field <prefix> <instrument> <qid> cp_field_gate (two real cells from the conf, or abstains) EXITS 0 OK 1 REFUSED (also ALERT fired, TAMPERED) 2 usage 3 UNOBSERVABLE (abstain, never acquit) license_tier: ORIGINAL

dependencies 6 imports · 0 importers

nx_survey_stats.nx nx_cell_lib.nx nx_kfloor_lib.nx nx_lineconf_lib.nx nx_sha256.nx nx_ed25519_signature.nx nx_communitypulse.nx

imports: nx_survey_stats.nxnx_cell_lib.nxnx_kfloor_lib.nxnx_lineconf_lib.nxnx_sha256.nxnx_ed25519_signature.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main cp_usage cp_p cp_conf_load cp_p ↻ cp_org_scope cp_conf_s lcf_str lcf_find cp_p ↻ cel_put cel_id_ok cel_kind_ok se_slen se_slen ↻ se_seq cel_get cel_key se_cat se_get_dec sys_mmap nxa_die nxa_lock_take nxa_lock_give nxa_report_overrun ss_open_cached ssc_init ssc_sig_of ssc_streq ss_open ssc_retire_handle ss_hget sys_mmap ↻ ss_len ss_hlocate ss_r32 ss_idx_find canon_decode ud_r32 sys_mmap ↻

structs

none

consts

31const CP_EXIT_OK: i64 = 0
32const CP_EXIT_REFUSED: i64 = 1
33const CP_EXIT_USAGE: i64 = 2
34const CP_EXIT_UNOBSERVABLE: i64 = 3
35const CP_CELLS: i64 = 512 // == SE_WALK_CAPMAX, the engine's walk bound (a larger cap REFUSES there)
36const CP_BALLOTS: i64 = 512 // == SE_WALK_CAPMAX
37const CP_ROW_BYTES: i64 = 512 // one emitted row or html block per cell, bounded by the name cap below
38const CP_HDR_BYTES: i64 = 8192 // page chrome + export header + trailer
39const CP_OUT_BYTES: i64 = 270336 // CP_CELLS * CP_ROW_BYTES + CP_HDR_BYTES
40const CP_NAME_CAP: i64 = 128
41const CP_PATH_CAP: i64 = 512
42const CP_SPEC_CAP: i64 = 32768 // an instrument spec; 12 items x 512-byte prompts fits with room
43const CP_FIELDS: i64 = 32
44const CP_PM: i64 = 1000 // == ST_SCALE
45const CP_PM2: i64 = 1000000 // CP_PM * CP_PM
46const CP_CENTI: i64 = 10 // pm -> hundredths for display
47const CP_SEED_HEX: i64 = 64
48const CP_SEED_BYTES: i64 = 32
49const CP_PUB_BYTES: i64 = 32
50const CP_SIG_BYTES: i64 = 64
51const CP_HASH_BYTES: i64 = 32
52const CP_HEX_CAP: i64 = 130 // 64 bytes -> 128 hex + NUL, rounded up
53const CP_STATE_PUB: *u8 = "PUBLISHED"
54const CP_STATE_K: *u8 = "WITHHELD-UNDER-K"
55const CP_STATE_COMP: *u8 = "WITHHELD-COMPLEMENTARY"
56const CP_TOK_PFX: *u8 = "kiosk-"
57const CP_ASCII_NL: i64 = 10
58const CP_ASCII_CR: i64 = 13
59const CP_ASCII_EQ: i64 = 61
60const CP_ASCII_COMMA: i64 = 44
61const CP_ASCII_BANG: i64 = 33
62const CP_ASCII_HASH: i64 = 35
63const CP_ASCII_DOT: i64 = 46
64const CP_ASCII_ZERO: i64 = 48
65const CP_ASCII_A: i64 = 97
66const CP_HEX_RADIX: i64 = 16
67const CP_HEX_LETTER: i64 = 10
68const CP_BYTE_MASK: i64 = 255
69const CP_TWO: i64 = 2
70const CP_WORD: i64 = 8 // sizeof(i64)
71const CP_ERR_WALK: i64 = 0 - 1
72const CP_ERR_PARENT: i64 = 0 - 2
73const CP_ERR_CONF: i64 = 0 - 3
74const CP_ERR_TREE: i64 = 0 - 4
75const CP_ASCII_LT: i64 = 60
76const CP_ASCII_GT: i64 = 62
77const CP_ASCII_AMP: i64 = 38
78const CP_ASCII_APOS: i64 = 39
79const CP_ASCII_PIPE: i64 = 124
80const CP_ASCII_COLON: i64 = 58
81const CP_ASCII_DASH: i64 = 45
82const CP_DECIMAL: i64 = 10
83const CP_DEC_LAST: i64 = 9
84const CP_HEX_LAST: i64 = 5
85const CP_LP_BYTES: i64 = 16 // two i64 slots for sys_read_file
86const CP_SCR_BYTES: i64 = 64
87const CP_PART_SLOTS: i64 = 4
88const CP_TREND_SLOTS: i64 = 8
89const CP_SHA_LINE_PFX: i64 = 7 // strlen("sha256=")

functions

93func cp_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
94func cp_pn(v: i64) -> i64
101func cp_fixed2(dst: *u8, off: i64, pm: i64) -> i64
called by 1: cp_public_page
113func cp_hex(b: *u8, n: i64, out: *u8) -> i64
128func cp_hexval(c: i64) -> i64
called by 1: cp_unhex
133func cp_unhex(s: *u8, nbytes: i64, out: *u8) -> i64
145func cp_write_file(path: *u8, buf: *u8, n: i64) -> i64
157func cp_conf_load(path: *u8) -> i64
called by 1: main
166func cp_conf_i(key: *u8) -> i64
171func cp_conf_s(key: *u8, out: *u8, cap: i64) -> i64 { return lcf_str(cp_conf_g, cp_confn_g, key, out, cap) }
193func cp_model_alloc() -> i64
214func cp_cell_index(id: *u8) -> i64
220func cp_load_cells(prefix: *u8) -> i64
267func cp_cell_ballots(prefix: *u8, inst: *u8, id: *u8) -> i64
273func cp_floor(prefix: *u8, inst: *u8) -> i64
292func cp_model(prefix: *u8, inst: *u8, qid: *u8) -> i64
333func cp_mean_pm(i: i64) -> i64 { if cp_tot_g[i] <= 0 { return 0 } return cp_tsum_g[i] * CP_PM / cp_tot_g[i] }
335func cp_margin_pm(i: i64) -> i64
343func cp_state_str(i: i64) -> *u8
349func cp_complement_suppress(k: i64) -> i64 { return kfl_complement_suppress(cp_tot_g, cp_cpar_g, cp_nc_g, k, cp_state_g) }
called by 1: cp_rollup calls 1: kfl_complement_suppress
350func cp_rollup(prefix: *u8, inst: *u8, qid: *u8) -> i64
395func cp_under(j: i64, i: i64) -> i64
called by 1: cp_weights
408func cp_weights(prefix: *u8, inst: *u8, qid: *u8) -> i64
449func cp_benchmark(child_mean: i64, child_margin: i64, parent_mean: i64, parent_margin: i64, out: *i64) -> i64
called by 1: cp_public_page
459func cp_html_esc(dst: *u8, off: i64, s: *u8) -> i64
called by 1: cp_public_page calls 1: se_cat
473func cp_public_page(prefix: *u8, inst: *u8, qid: *u8, cell: *u8, path: *u8) -> i64
554func cp_alert(prefix: *u8, inst: *u8, cell: *u8, qid: *u8) -> i64
580func cp_export_body(inst: *u8, qid: *u8, out: *u8) -> i64
602func cp_open_export(prefix: *u8, inst: *u8, qid: *u8, path: *u8) -> i64
638func cp_verify_export(path: *u8) -> i64
673func cp_instrument(prefix: *u8, specpath: *u8, inst: *u8, cell: *u8) -> i64
740func cp_kiosk(prefix: *u8, inst: *u8, cell: *u8, argc: i64, argv: *i64, first: i64) -> i64
798func cp_field_gate(prefix: *u8, inst: *u8, qid: *u8) -> i64
832func cp_org_scope(prefix: *u8, id: *u8, kind: *u8, name: *u8, parent: *u8, denom: i64) -> i64
called by 1: main calls 4: cp_conf_scp_pcel_putcp_pn
845func cp_cell_list(prefix: *u8) -> i64
called by 1: main calls 3: cp_load_cellscp_pcp_pn
859func cp_usage() -> i64
called by 1: main calls 1: cp_p
873func main(argc: i64, argv: *i64) -> i64