nx_communitypulse.nx
buildroot/runtime/nx_communitypulse.nx
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
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
structs
| none |
consts
| 31 | const CP_EXIT_OK: i64 = 0 |
| 32 | const CP_EXIT_REFUSED: i64 = 1 |
| 33 | const CP_EXIT_USAGE: i64 = 2 |
| 34 | const CP_EXIT_UNOBSERVABLE: i64 = 3 |
| 35 | const CP_CELLS: i64 = 512 // == SE_WALK_CAPMAX, the engine's walk bound (a larger cap REFUSES there) |
| 36 | const CP_BALLOTS: i64 = 512 // == SE_WALK_CAPMAX |
| 37 | const CP_ROW_BYTES: i64 = 512 // one emitted row or html block per cell, bounded by the name cap below |
| 38 | const CP_HDR_BYTES: i64 = 8192 // page chrome + export header + trailer |
| 39 | const CP_OUT_BYTES: i64 = 270336 // CP_CELLS * CP_ROW_BYTES + CP_HDR_BYTES |
| 40 | const CP_NAME_CAP: i64 = 128 |
| 41 | const CP_PATH_CAP: i64 = 512 |
| 42 | const CP_SPEC_CAP: i64 = 32768 // an instrument spec; 12 items x 512-byte prompts fits with room |
| 43 | const CP_FIELDS: i64 = 32 |
| 44 | const CP_PM: i64 = 1000 // == ST_SCALE |
| 45 | const CP_PM2: i64 = 1000000 // CP_PM * CP_PM |
| 46 | const CP_CENTI: i64 = 10 // pm -> hundredths for display |
| 47 | const CP_SEED_HEX: i64 = 64 |
| 48 | const CP_SEED_BYTES: i64 = 32 |
| 49 | const CP_PUB_BYTES: i64 = 32 |
| 50 | const CP_SIG_BYTES: i64 = 64 |
| 51 | const CP_HASH_BYTES: i64 = 32 |
| 52 | const CP_HEX_CAP: i64 = 130 // 64 bytes -> 128 hex + NUL, rounded up |
| 53 | const CP_STATE_PUB: *u8 = "PUBLISHED" |
| 54 | const CP_STATE_K: *u8 = "WITHHELD-UNDER-K" |
| 55 | const CP_STATE_COMP: *u8 = "WITHHELD-COMPLEMENTARY" |
| 56 | const CP_TOK_PFX: *u8 = "kiosk-" |
| 57 | const CP_ASCII_NL: i64 = 10 |
| 58 | const CP_ASCII_CR: i64 = 13 |
| 59 | const CP_ASCII_EQ: i64 = 61 |
| 60 | const CP_ASCII_COMMA: i64 = 44 |
| 61 | const CP_ASCII_BANG: i64 = 33 |
| 62 | const CP_ASCII_HASH: i64 = 35 |
| 63 | const CP_ASCII_DOT: i64 = 46 |
| 64 | const CP_ASCII_ZERO: i64 = 48 |
| 65 | const CP_ASCII_A: i64 = 97 |
| 66 | const CP_HEX_RADIX: i64 = 16 |
| 67 | const CP_HEX_LETTER: i64 = 10 |
| 68 | const CP_BYTE_MASK: i64 = 255 |
| 69 | const CP_TWO: i64 = 2 |
| 70 | const CP_WORD: i64 = 8 // sizeof(i64) |
| 71 | const CP_ERR_WALK: i64 = 0 - 1 |
| 72 | const CP_ERR_PARENT: i64 = 0 - 2 |
| 73 | const CP_ERR_CONF: i64 = 0 - 3 |
| 74 | const CP_ERR_TREE: i64 = 0 - 4 |
| 75 | const CP_ASCII_LT: i64 = 60 |
| 76 | const CP_ASCII_GT: i64 = 62 |
| 77 | const CP_ASCII_AMP: i64 = 38 |
| 78 | const CP_ASCII_APOS: i64 = 39 |
| 79 | const CP_ASCII_PIPE: i64 = 124 |
| 80 | const CP_ASCII_COLON: i64 = 58 |
| 81 | const CP_ASCII_DASH: i64 = 45 |
| 82 | const CP_DECIMAL: i64 = 10 |
| 83 | const CP_DEC_LAST: i64 = 9 |
| 84 | const CP_HEX_LAST: i64 = 5 |
| 85 | const CP_LP_BYTES: i64 = 16 // two i64 slots for sys_read_file |
| 86 | const CP_SCR_BYTES: i64 = 64 |
| 87 | const CP_PART_SLOTS: i64 = 4 |
| 88 | const CP_TREND_SLOTS: i64 = 8 |
| 89 | const CP_SHA_LINE_PFX: i64 = 7 // strlen("sha256=") |
functions
| 93 | func 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 } |
| 94 | func cp_pn(v: i64) -> i64 |
| 101 | func cp_fixed2(dst: *u8, off: i64, pm: i64) -> i64 called by 1: cp_public_page |
| 113 | func cp_hex(b: *u8, n: i64, out: *u8) -> i64 |
| 128 | func cp_hexval(c: i64) -> i64 called by 1: cp_unhex |
| 133 | func cp_unhex(s: *u8, nbytes: i64, out: *u8) -> i64 |
| 145 | func cp_write_file(path: *u8, buf: *u8, n: i64) -> i64 |
| 157 | func cp_conf_load(path: *u8) -> i64 called by 1: main |
| 166 | func cp_conf_i(key: *u8) -> i64 |
| 171 | func cp_conf_s(key: *u8, out: *u8, cap: i64) -> i64 { return lcf_str(cp_conf_g, cp_confn_g, key, out, cap) } |
| 193 | func cp_model_alloc() -> i64 |
| 214 | func cp_cell_index(id: *u8) -> i64 |
| 220 | func cp_load_cells(prefix: *u8) -> i64 called by 2: cp_modelcp_cell_list calls 7: cp_model_alloccel_listcp_pcanon_decodecel_fieldcel_field_n+1 |
| 267 | func cp_cell_ballots(prefix: *u8, inst: *u8, id: *u8) -> i64 |
| 273 | func cp_floor(prefix: *u8, inst: *u8) -> i64 |
| 292 | func cp_model(prefix: *u8, inst: *u8, qid: *u8) -> i64 |
| 333 | func 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] } |
| 335 | func cp_margin_pm(i: i64) -> i64 |
| 343 | func cp_state_str(i: i64) -> *u8 |
| 349 | func cp_complement_suppress(k: i64) -> i64 { return kfl_complement_suppress(cp_tot_g, cp_cpar_g, cp_nc_g, k, cp_state_g) } |
| 350 | func cp_rollup(prefix: *u8, inst: *u8, qid: *u8) -> i64 |
| 395 | func cp_under(j: i64, i: i64) -> i64 called by 1: cp_weights |
| 408 | func cp_weights(prefix: *u8, inst: *u8, qid: *u8) -> i64 |
| 449 | func cp_benchmark(child_mean: i64, child_margin: i64, parent_mean: i64, parent_margin: i64, out: *i64) -> i64 called by 1: cp_public_page |
| 459 | func cp_html_esc(dst: *u8, off: i64, s: *u8) -> i64 |
| 473 | func cp_public_page(prefix: *u8, inst: *u8, qid: *u8, cell: *u8, path: *u8) -> i64 |
| 554 | func cp_alert(prefix: *u8, inst: *u8, cell: *u8, qid: *u8) -> i64 |
| 580 | func cp_export_body(inst: *u8, qid: *u8, out: *u8) -> i64 |
| 602 | func cp_open_export(prefix: *u8, inst: *u8, qid: *u8, path: *u8) -> i64 |
| 638 | func cp_verify_export(path: *u8) -> i64 |
| 673 | func cp_instrument(prefix: *u8, specpath: *u8, inst: *u8, cell: *u8) -> i64 |
| 740 | func cp_kiosk(prefix: *u8, inst: *u8, cell: *u8, argc: i64, argv: *i64, first: i64) -> i64 |
| 798 | func cp_field_gate(prefix: *u8, inst: *u8, qid: *u8) -> i64 |
| 832 | func cp_org_scope(prefix: *u8, id: *u8, kind: *u8, name: *u8, parent: *u8, denom: i64) -> i64 |
| 845 | func cp_cell_list(prefix: *u8) -> i64 |
| 859 | func cp_usage() -> i64 |
| 873 | func main(argc: i64, argv: *i64) -> i64 |