nx_communitypulse_gate.nx
buildroot/runtime/nx_communitypulse_gate.nx
about
nx_communitypulse_gate.nx -- THE GATE FOR THE COMMUNITY PULSE (2026-08-24).
SUBJECT: the nx_communitypulse ELF, forked for real with a fresh store per run (/tmp/<gate>/r<usec>/), so
the gate is idempotent by construction: nothing measured here was inherited from an earlier run.
FIXTURE: a six-cell forest nation > region > locality > {church a, agency b, nonprofit c}; a one-item
pulse instrument; kiosk ballots a=7 b=6 c=2 under k=5. That shape is chosen so every release state
occurs at once: a and b PUBLISHED, c WITHHELD-UNDER-K, the locality WITHHELD-COMPLEMENTARY (15 - 7 - 6 = 2
contributors would be isolatable), the region PUBLISHED (its only child is withheld, residual 15), the
nation PUBLISHED (residual 0). Every expected number below is derived from those ballots by hand and
asserted exactly; no tooth passes on an empty set (the fixture-reached-the-condition teeth come first).
Every negative control is a gv_bite: fires on the crafted bad input AND stays silent on the good one.
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.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
| 16 | const CPG_SUBJECT_DEFAULT: *u8 = "_offc/nx_communitypulse.elf" |
| 17 | const CPG_DIR: *u8 = "/tmp/nx_communitypulse_gate" |
| 18 | const CPG_EXIT_OK: i64 = 0 |
| 19 | const CPG_EXIT_REFUSED: i64 = 1 |
| 20 | const CPG_EXIT_USAGE: i64 = 2 |
| 21 | const CPG_EXIT_UNOBSERVABLE: i64 = 3 |
| 22 | const CPG_MODE_DIR: i64 = 493 // 0755 |
| 23 | const CPG_CAPTURE_CAP: i64 = 65536 |
| 24 | const CPG_PATH_CAP: i64 = 512 |
| 25 | const CPG_ARGV_SLOTS: i64 = 16 |
| 26 | const CPG_WORD: i64 = 8 |
| 27 | const CPG_CONF_BYTES: i64 = 4096 |
| 28 | const CPG_NUM_BYTES: i64 = 32 |
| 29 | const CPG_SMALL: i64 = 16 |
| 30 | const CPG_ASCII_DASH: i64 = 45 |
| 31 | const CPG_ASCII_ZERO: i64 = 48 |
| 32 | const CPG_DECIMAL: i64 = 10 |
| 33 | const CPG_LP_BYTES: i64 = 16 |
| 34 | const CPG_ASCII_NL: i64 = 10 |
| 35 | const CPG_ASCII_M: i64 = 77 |
| 37 | const CPG_K: i64 = 5 |
| 38 | const CPG_RATE_MAX: i64 = 7 |
| 39 | const CPG_WINDOW_US: i64 = 3600000000 // one hour: every fixture ballot is inside it, so the trend halves cannot both clear k |
| 40 | const CPG_A_DENOM: i64 = 100 |
| 41 | const CPG_B_DENOM: i64 = 50 |
| 42 | const CPG_C_DENOM: i64 = 20 |
| 43 | const CPG_A_N: i64 = 7 |
| 44 | const CPG_EXPECT_A_MEAN: *u8 = "|own=7|total=7|PUBLISHED|mean_pm=6285|" // 2+3+3+8+9+9+10 = 44; 44000/7 |
| 45 | const CPG_EXPECT_B_MEAN: *u8 = "|own=6|total=6|PUBLISHED|mean_pm=8000|" // 6+7+8+8+9+10 = 48; 48000/6 |
| 46 | const CPG_EXPECT_C: *u8 = "row|c|nonprofit|l1|own=2|total=2|WITHHELD-UNDER-K|" |
| 47 | const CPG_EXPECT_L1: *u8 = "row|l1|locality|r1|own=0|total=15|WITHHELD-COMPLEMENTARY|" |
| 48 | const CPG_EXPECT_R1: *u8 = "row|r1|region|n1|own=0|total=15|PUBLISHED|mean_pm=6866|" // (44+48+11)*1000/15 |
| 49 | const CPG_EXPECT_N1: *u8 = "row|n1|nation|-|own=0|total=15|PUBLISHED|mean_pm=6866|" |
| 50 | const CPG_EXPECT_PART: *u8 = "partition published=4 withheld_k=1 withheld_comp=1 sum=6 cells=6 SUMS" |
| 51 | const CPG_EXPECT_BALLOTS: *u8 = "ballots own_sum=15 roots_total=15 SUMS" |
| 52 | const CPG_EXPECT_WEIGHTED_R1: *u8 = "weighted|r1|PUBLISHED|wmean_pm=6697|denom_sum=170|leaves=3" // (6285*100 + 8000*50 + 5500*20) / 170 |
functions
| 56 | func cpg_write_text(path: *u8, s: *u8) -> i64 |
| 66 | func cpg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off + i] = s[i]; i = i + 1 } return off + i } |
| 67 | func cpg_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 78 | func cpg_path(dir: *u8, leaf: *u8) -> *u8 |
| 87 | func cpg_run(subject: *u8, conf: *u8, verb: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, a5: *u8, a6: *u8, a7: *u8) -> i64 |
| 111 | func cpg_has(needle: *u8) -> i64 { return tr_contains(cpg_cap_g, cpg_olen_g[0], needle) } |
| 112 | func cpg_file_has(path: *u8, needle: *u8) -> i64 |
| 118 | func cpg_nil() -> *u8 { return 0 as *u8 } |
| 119 | func cpg_kiosk1(subject: *u8, conf: *u8, prefix: *u8, cell: *u8, v: *u8) -> i64 |
| 127 | func main(argc: i64, argv: *i64) -> i64 |